UNPKG

@envelop/response-cache-cloudflare-kv

Version:
21 lines (20 loc) 668 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildOperationKey = buildOperationKey; exports.buildEntityKey = buildEntityKey; function buildOperationKey(operationId, keyPrefix = undefined) { if (keyPrefix) { return `${keyPrefix}:operation:${operationId}`; } return `operation:${operationId}`; } function buildEntityKey(entityTypename, entityId = undefined, keyPrefix = undefined) { let finalKey = keyPrefix ? `${keyPrefix}:` : ''; if (entityId) { finalKey += `entity:${entityTypename}:${entityId}`; } else { finalKey += `entity:${entityTypename}`; } return finalKey; }