Skip to main content


Cache subsystem designed to store some values for quick access and unified interface. It is useful when you have some values grabbed from external api or some stuff that requires a lot of calculation and not changing from time to time.

Caches have expiration time and the developer should not worry to check it. It value expired or not exist then callback will be executed and it return value will be used as value to store on cache


Cache subsystem handled all values and take care or serialization/deserialization


Api is simple

  async getSetValue(
key: String,
onNotFound: () => Promise<any>,
storeTime: number, // in seconds
): Promise<any>;

By default store time 5 minutes.


const cacheTime = 60 * 5; // seconds
const someValueFromCache = await
async () => {
const someValue = await someLongAsyncOperation();
return someValue;
cacheTime // in seconds

You can request same value multiple times and only one callback will be executed all other values will be resolved as Promise (same promise)

const promiseArr = []
for (let n=0;n<100;n++){}
async () => { // will be called once! Other call will find that "someKey" already processing and return same Promise
const someValue = await someLongAsyncOperation();
return someValue;

Please note that it works that way per process as checking promises happens on process level and not synchronized via master process.


For now the cache subsystem has no configuration. But please follow Redis configuration as cache depend on it