Cache Manager API Reference
The Cache Manager provides a unified interface for various caching strategies and backends optimized for edge environments.CacheManager
Main cache management class supporting multiple backends and strategies.Constructor
options(object): Cache configuration options
backend(string): Cache backend (‘memory’, ‘redis’, ‘cloudflare-kv’)ttl(number): Default TTL in millisecondsmaxSize(number): Maximum cache sizestrategy(string): Eviction strategy (‘lru’, ‘lfu’, ‘fifo’)compression(boolean): Enable compressionnamespace(string): Cache namespace
Methods
get(key, options)
Retrieve a value from cache.key(string): Cache keyoptions(object, optional): Get options
set(key, value, options)
Store a value in cache.key(string): Cache keyvalue(any): Value to cacheoptions(object, optional): Set options
delete(key)
Remove a value from cache.key(string): Cache key
clear()
Clear all cached values.has(key)
Check if key exists in cache.key(string): Cache key
getStats()
Get cache statistics.memoize(fn, options)
Create a memoized version of a function.fn(function): Function to memoizeoptions(object, optional): Memoization options