Skip to content

Oscaner/type-cacheable-cache-manager-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@oscaner/cache-manager-adapter

npm downloads

🎉 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.

View full documentation

Usage

Installation

# npm install --save @type-cacheable/core @oscaner/cache-manager-adapter
npm install --save @type-cacheable/core https://github.com/Oscaner/type-cacheable-cache-manager-adapter.git#main

Using adapter

See the cache-manager documentation for more information on available store engines.

import { useAdapter } from '@oscaner/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

About

A new cache manager adapter for type-cacheable.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published