cachified-adapter-sqlite
Version:
SQLite adapter for @epic-web/cachified. Compatible with better-sqlite3, sqlite, sqlite3, node:sqlite, and bun:sqlite.
20 lines (17 loc) • 513 B
JavaScript
function staleWhileRevalidate(metadata) {
return (typeof metadata.swr === "undefined" ? metadata.swv : metadata.swr) || null;
}
function totalTtl(metadata) {
if (!metadata) {
return 0;
}
if (metadata.ttl === null) {
return Infinity;
}
return (metadata.ttl || 0) + (staleWhileRevalidate(metadata) || 0);
}
function buildCacheKey(key, keyPrefix) {
return keyPrefix ? `${keyPrefix}:${key}` : key;
}
export { buildCacheKey as b, totalTtl as t };
//# sourceMappingURL=cache-key-CFVg9mcK.js.map