encodeSegment
●tagtree · /core·function
Encodes a single cache-key segment so it is safe to join with . as a separator; escapes .
and : in addition to the characters encodeURIComponent already handles.
Signature
function encodeSegment(value: string | number): string;Parameters
| Name | Type | Description |
|---|---|---|
value | string | number |
Returns
The percent-encoded segment string, safe for use as a dotted-path component.
Example
encodeSegment('shop.example.com'); // 'shop%2Eexample%2Ecom'
encodeSegment(42); // '42'Related
ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape
MetadataOpen in GitHub ↗
defineCache
Validates and freezes a cache schema definition, rejecting namespace or entity names that contain . (which would produce ambiguous dotted tags), then returns a
EntitiesMap
Constraint type for the entities record passed to defineCache; maps entity names to their EntityDecl shapes, ensuring all values conform to the expected param a