Skip to content

sajjadkarimi/typeorm-lru-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

An lru-cache for typeorm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published