@travetto/model-redis
v7.1.4
Published
Redis backing for the travetto model module.
Downloads
881
Maintainers
Readme
Redis Model Support
Redis backing for the travetto model module.
Install: @travetto/model-redis
npm install @travetto/model-redis
# or
yarn add @travetto/model-redisThis module provides an redis-based implementation for the Data Modeling Support. This source allows the Data Modeling Support module to read, write and query against redis.
Supported features:
Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source or config, you can override and register it with the Dependency Injection module.
Code: Wiring up a custom Model Source
import { InjectableFactory } from '@travetto/di';
import { type RedisModelConfig, RedisModelService } from '@travetto/model-redis';
export class Init {
@InjectableFactory({
primary: true
})
static getModelSource(config: RedisModelConfig) {
return new RedisModelService(config);
}
}where the RedisModelConfig is defined by:
Code: Structure of RedisModelConfig
@Config('model.redis')
export class RedisModelConfig {
client: redis.RedisClientOptions = {};
namespace?: string;
modifyStorage?: boolean;
}Additionally, you can see that the class is registered with the @Config annotation, and so these values can be overridden using the standard Configuration resolution paths.
