10 lines
484 B
JavaScript
10 lines
484 B
JavaScript
export default function grabCacheNames({ key, cache_id, paradigm = "html", }) {
|
|
// Hashing keeps file names short and fixed-length no matter how long
|
|
// the request path or query string is.
|
|
const parsed_key = cache_id ||
|
|
new Bun.CryptoHasher("sha256").update(key || "").digest("hex");
|
|
const cache_name = `${parsed_key}.res.${paradigm}`;
|
|
const cache_meta_name = `${parsed_key}.meta.json`;
|
|
return { cache_id: parsed_key, cache_name, cache_meta_name };
|
|
}
|