@dephub/cache
Version:
Simple file-based cache with persistent storage for Node.js applications
22 lines (21 loc) • 632 B
JavaScript
class n extends Map {
/**
* Sets a value in the cache.
*
* @param key - Cache key (must be a string)
* @param value - Value to store (string, number, or boolean)
* @returns The cache instance for chaining
* @throws {Error} If key is not a string
* @throws {Error} If value is not string, number, or boolean
*/
set(e, r) {
if (typeof e != "string")
throw new Error("Cache key must be a string");
if (!["string", "number", "boolean"].includes(typeof r))
throw new Error("Cache value must be string, number, or boolean");
return super.set(e, r);
}
}
export {
n as MemoryCache
};