⚙️ Settings

Learn all the settings you can configure in the cache.

Overview

Being able to customize the cache settings you use is essential for it to be efficient and tailored to your needs, which is why there are multiple configurations available to you.


To set custom configurations, you must instantiate a new cache and send it as parameters.

import { Cache } from "toolkitify/cache";

const cache = new Cache({
    // All settings here.
});

And for function caching, it would be done as follows:

import { cacheFunction } from "toolkitify/cache";

const cachedFunc = cacheFunction(fn, {
    // All settings here.
});
Review the settings for cacheFunction here.

Interfaces

ParameterTypeRequiredDescription
ttlString | NumberFunction cache lifetime
maxUses | max_usesStringMaximum number of uses
storageStorage[]Storage to use
logsLogs[]Logs to use

Storage

ParameterType
storagememory | localStorage | sessionStorage | cookies

Logs

ParameterType
logsusage | none