You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
3 years ago | |
---|---|---|
deploy/config | 3 years ago | |
src | 3 years ago | |
.gitignore | 3 years ago | |
README.md | 3 years ago | |
package.json | 3 years ago | |
yarn.lock | 3 years ago |
README.md
flitter-redis
Flitter-Redis is a lightweight wrapper around IORedis. It simply provides a configuration file for IORedis and makes a connection available as a service method.
Getting Started
Install
yarn add flitter-redis
Add the RedisUnit to Units.flitter.js
, under "Pre-Routing Custom Units":
'Redis' : require('./redis/src/RedisUnit'),
Deploy & Config
Run the deployment to create the configuration file:
./flitter deploy redis
Now edit the server configuration as necessary in the config/redis.config.js
file.
Basic Usage
You can get the instance of the IORedis client from the redis
service in any injectable class. For example, in a controller:
class SomeController extends Controller {
static get services() {
return [...super.services, 'redis']
}
async some_method(...args) {
const redis_client = this.redis.client()
await redis_client.set('hello', 'world!')
console.log(await redis_client.get('hello')) // => world!
}
}
See the IORedis docs for more usage information.