Cachified is an easy to use, redis-powered caching library that allows you to quickly cache your functions using TypeScript decorators.
It allows you to cache functions with a one line addition to your code.
A simple but descriptive example on how to use Cachified can be found in the example folder.
import{Injectable}from'@nestjs/common';import{Cachified}from'@venix/cachified';
@Injectable()exportclassExampleService{
@Cachified()cachedMethod(){return"Hey from cached method"}}import{Module}from'@nestjs/common';import{CachifiedModule}from'@venix/cachified';import{ExampleService}from'./example.service.ts';constisProduction=process.env.NODE_ENV==='production'; @Module({imports: [CachifiedModule.forRoot({enabled: isProduction,client: {host: '127.0.0.1',port: 6379,db: 0,keyPrefix: 'project:'}})],providers: [ExampleService]})exportclassApplicationModule{}import{Module}from'@nestjs/common';import{CachifiedModule}from'@venix/cachified';import*asIORedisfrom'ioredis';import{ExampleService}from'./example.service.ts';constisProduction=process.env.NODE_ENV==='production';constredisClient=newIORedis({host: '127.0.0.1',port: 6379,db: 0,keyPrefix: 'project:'});
@Module({imports: [CachifiedModule.forRoot({enabled: isProduction,client: redisClient})],providers: [ExampleService]})exportclassApplicationModule{}If you have any feature requests you would like to be implemented please open an issue.