jaredwray / cache-manager

Cache module for Node.JS
MIT License
1.4k stars 152 forks source link

Bug in docs: "Create single cache store synchronously" doesn't pass options to store #687

Closed Juraj-Masiar closed 1 month ago

Juraj-Masiar commented 2 months ago

Describe the bug In the example:

// Create memory cache synchronously
const memoryCache = createCache(memoryStore(), {
  max: 100,
  ttl: 10 * 1000 /*milliseconds*/,
});

The options are passed to the createCache, but not to the memoryStore function! This then means that both "max" and "ttl" options have no effect, since they are both used only by the store.

Unlike when using async caching, which passes the options to the store: https://github.com/jaredwray/cache-manager/blob/0d5b97d03f5283605a82984dc93803414180df7b/packages/cache-manager/src/caching.ts#L90

jaredwray commented 1 month ago

@Juraj-Masiar - thanks for finding this and we have updated the docs. Should be published shortly