Skip to content

Instantly share code, notes, and snippets.

@abdavid
abdavid / CacheComposer.ts
Last active March 23, 2021 11:57
Cache composing in MoleculerJS
/**
POC of cache composing.
The idea behind this madnes was to compose multiple layers of LRU type caches,
with the first layer being local (LRUMemcache) with a 1:1 with configured TTL, and for each subsequent tier 1:n of the configured ttl.
In effect that would mean that when a cached item gets shifted out of the first layer due to being regarded as the least recently used,
it would still exising in the second layer giving it a grace period of sorts before deleting the cache entry from all layers.
BUT WHY you may ask?

Keybase proof

I hereby claim:

  • I am abdavid on github.
  • I am abdavid (https://keybase.io/abdavid) on keybase.
  • I have a public key ASDGPVAfYcMsFu05B1bgCkBwqO_qELu98j9hjdR2vc87kAo

To claim this, I am signing this object: