Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Library for caching data with many engines(memory,redis,etc...).

Notifications You must be signed in to change notification settings

Blynskyniki/cache-service

Repository files navigation

##Library for caching data with many engines(memory,redis,etc...). Every instance typed from your data. If you want create custom engine, please use EngineAbstract.

Exapmles:

import { TypedCache,MemoryEngine } from './index';

// create service for typed cache
const service = await TypedCache.getInstance<string>({
  ttl: 60000, // in ms
  engine: new MemoryEngine<string>(),
});
// set key
const key1 = await service.set('myCacheString1');
// set auto update key data with ttl
const key2 = await service.setAutoUpdateCache(async () => {
  return 'myCacheString2';
});
// get data from key
const res1 = await service.get(key1);
// get data from multi keys
const mget = await service.mget([key1, key2]);
// delete key
await service.del(key1);

About

Library for caching data with many engines(memory,redis,etc...).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published