⚙️ 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
| Parameter | Type | Required | Description |
|---|---|---|---|
ttl | String | Number | ❌ | Function cache lifetime |
maxUses | max_uses | String | ❌ | Maximum number of uses |
storage | Storage[] | ❌ | Storage to use |
logs | Logs[] | ❌ | Logs to use |
Storage
| Parameter | Type |
|---|---|
storage | memory | localStorage | sessionStorage | cookies |
Logs
| Parameter | Type |
|---|---|
logs | usage | none |