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

0.0.3 • Public • Published

typeorm-lru-cache

An in-memory lru cache for typeorm

Basically just a wrapper for lru-cache

Usage

Use the provider for the cache when configuring typeorm

import LRUCacheProvider from 'typeorm-lru-cache'
{
    ...
    cache: {
        provider: () => {
            return new LRUCacheProvider({
              max: 1000,

              // how long to live in ms
              ttl: 20000,

              // return stale items before removing from cache?
              allowStale: false,

              updateAgeOnGet: false,
              updateAgeOnHas: false,
            });
          },
    }
}

Package Sidebar

Install

npm i typeorm-lru-cache

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

5.15 kB

Total Files

5

Last publish

Collaborators

  • sajjadkarimi