Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 733 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 733 Bytes

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,
            });
          },
    }
}