@type-cacheable/cache-manager-adapter
TypeScript icon, indicating that this package has built-in type declarations

17.0.0 • Public • Published

@type-cacheable/cache-manager-adapter

npm downloads

TypeScript-based caching decorators to assist with caching (and clearing cache for) async methods. This package supports cache-manager 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 cache-manager maintainers and users.

View full documentation

Usage

Installation

npm install --save @type-cacheable/core @type-cacheable/cache-manager-adapter

Using adapter

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

import { sqliteStore } from '@resolid/cache-manager-sqlite';
import * as cacheManager from 'cache-manager';
import { join } from 'node:path';
import { useAdapter } from '@type-cacheable/cache-manager-adapter';

// An example using the @resolid/cache-manager-sqlite adapter
const store = sqliteStore({
  cacheTableName: 'cache',
  sqliteFile: join(process.cwd(), 'cache.sqlite3'),
});

const cacheManagerCache = cacheManager.createCache(store);

const clientAdapter = useAdapter(cacheManagerCache);

Then you can rely on the @Cacheable, @CacheUpdate, and @CacheClear decorators from @type-cacheable/core. See core documentation

Package Sidebar

Install

npm i @type-cacheable/cache-manager-adapter

Weekly Downloads

9

Version

17.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

6

Last publish

Collaborators

  • joshuaslate