This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

typed-cache
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

##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);

Readme

Keywords

Package Sidebar

Install

npm i typed-cache

Weekly Downloads

2

Version

1.0.4

License

ISC

Unpacked Size

11.2 kB

Total Files

18

Last publish

Collaborators

  • blynskyniki
  • satushev