@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 751 B
JavaScript
import e from"./cache-keys.mjs";import{bytesToHex as t,randomBytes as n}from"@noble/hashes/utils.js";const r=()=>`${Date.now()}:${t(n(16))}`,i=async(t,n)=>await t.kv.get(t,{key:e.namespace.token(n),hash:!0})??`0`,a=async(t,n)=>{let r=Array.from(new Set(n)),i=await t.kv.getMany(t,{keys:r.map(t=>({key:e.namespace.token(t),hash:!0}))}),a=r.map((e,t)=>[e,i[t]?.value??`0`]);return Object.fromEntries(a)},o=async(t,n)=>{await t.kv.set(t,{key:e.namespace.token(n),value:r(),hash:!0})},s=async(t,n)=>{await t.kv.setMany(t,{items:Array.from(new Set(n)).map(t=>({key:e.namespace.token(t),value:r(),hash:!0}))})};export{i as getNamespaceToken,a as getNamespaceTokens,o as invalidateNamespace,s as invalidateNamespaces};
//# sourceMappingURL=namespaces.mjs.map