Functions
Available Methods
Set
const myPayload = { id: 1, name: 'John', surname: 'Doe' }
await cache.set({ fileName: 'myFileName', key: 'myUniqueKey', payload: myPayload, ttl: 3600 })
// Stored as: myFileName hash_97c44f6f39acc990c8927e92168a61e2a3a1c9441679a1db76a1132562eb4ba6
Get
const data = await cache.get({ fileName: 'myFileName', key: 'myUniqueKey' });
// Gets cached data as: {"id":1,"name":"John","surname":"Doe"}
Get Files
Code
const files = cache.files()
Flush all
await cache.flushAll();
// Deletes all cached files
Flush by Regex
Code
await cache.flushByRegex('myFileName');
// or for multiple matches in file name
await cache.flushByRegex('myFileName', 'secondMatchValue');
Option enableMonitoring
is set to true
Get Logs
Code
const logs = cache.monitoring?.get()
Reset Logs
cache.monitoring?.reset()