Category
Documentation
Description
The framework includes a built-in Least Recently Used (LRU) Cache implementation located in lib/core/utils/LruCache.js. This utility is used internally (e.g., for page keep-alive caching) and is exported for general use. However, it is completely undocumented in the utility reference guide (docs/src/content/docs/api-reference/utils.md).
Proposed Solution
Update docs/src/content/docs/api-reference/utils.md to document the LruCache API:
- Document the constructor signature:
new LruCache(limit, onEvict).
- List and explain all public methods and properties:
get(key): retrieves a cached item and updates its recency.
set(key, value): inserts/updates a cached item, evicting the LRU item if the limit is exceeded.
has(key): checks key existence without updating recency.
delete(key): removes a key.
clear(): clears the cache.
size: getter for current size.
- Provide a clear code example showing instantiation, caching operations, and handling the
onEvict callback.
Acceptance Criteria
Category
Documentation
Description
The framework includes a built-in Least Recently Used (LRU) Cache implementation located in
lib/core/utils/LruCache.js. This utility is used internally (e.g., for page keep-alive caching) and is exported for general use. However, it is completely undocumented in the utility reference guide (docs/src/content/docs/api-reference/utils.md).Proposed Solution
Update
docs/src/content/docs/api-reference/utils.mdto document theLruCacheAPI:new LruCache(limit, onEvict).get(key): retrieves a cached item and updates its recency.set(key, value): inserts/updates a cached item, evicting the LRU item if the limit is exceeded.has(key): checks key existence without updating recency.delete(key): removes a key.clear(): clears the cache.size: getter for current size.onEvictcallback.Acceptance Criteria
LruCacheAPI reference is added todocs/src/content/docs/api-reference/utils.md.