🎉 cache-manager V6 supported
TypeScript-based caching decorators to assist with caching (and clearing cache for) async methods. This package supports keyv store engines.
This adapter is a bit different from the others, because it's essentially just giving you the option to use @type-cacheable/core decorators with store engines (similar to @type-cacheable's other adapters)
maintained by @type-cacheable's maintainers and users.
# npm install --save @type-cacheable/core @nodite/cache-manager-adapter
npm install --save @type-cacheable/core https://github.com/nodite/type-cacheable-cache-manager-adapter.git#mainSee the cache-manager documentation for more information on available store engines.
import { useAdapter } from '@nodite/cache-manager-adapter';
import { KeyvCacheableMemory } from 'cacheable';
import Keyv from 'keyv';
// An example using the @resolid/keyv-sqlite adapter
const keyv = new Keyv({
store: new KeyvCacheableMemory(),
useKeyPrefix: false,
serialize: undefined,
deserialize: undefined
});
const client = createCache({ stores: [keyv] });
const clientAdapter = useAdapter(client, [keyv]);Then you can rely on the @Cacheable, @CacheUpdate, and @CacheClear decorators from @type-cacheable/core. See core documentation