缓存键的类型 / Type of cache keys
缓存值的类型 / Type of cache values
创建带 TTL 的 LFU 缓存实例 Create an LFU cache instance with TTL support
缓存键的类型 / Type of cache keys
缓存值的类型 / Type of cache values
缓存容量,必须是正整数 / Cache capacity, must be a positive integer
生存时间(毫秒),必须是正整数 / Time-to-live in milliseconds, must be a positive integer
获取缓存的最大容量 Get the maximum capacity of the cache
缓存最大容量 / Maximum cache capacity
获取当前缓存中的元素数量 Get the number of items currently stored in the cache
当前缓存大小 / Current cache size
清空缓存中的所有数据 Clear all data in the cache
删除缓存中指定的键 Delete the specified key from the cache
删除成功时会从对应频次链表中移除节点,并在需要时更新最小频次。 When deletion succeeds, the node is removed from its frequency list and min frequency may be updated.
要删除的键 / Key to delete
如果键存在并被删除返回 true,否则返回 false / Returns true if key existed and was deleted, false otherwise
从缓存中获取指定键的值 Get the value associated with the specified key from the cache
获取操作会增加该键的访问频率并重置其 TTL。 The get operation increases the access frequency and resets the TTL of this key.
要获取的键 / Key to get
如果键存在且未过期返回对应的值,否则返回 undefined / Returns the value if key exists and is not expired, otherwise undefined
检查缓存中是否存在指定的键且未过期 Check if the specified key exists in the cache and is not expired
要检查的键 / Key to check
如果键存在且未过期返回 true,否则返回 false / Returns true if key exists and is not expired, false otherwise
向缓存中添加或更新键值对 Add or update a key-value pair in the cache
当前缓存实例(支持链式调用)/ Current cache instance (for chaining)
带有 TTL(生存时间)的 LFU 缓存类 LFU (Least Frequently Used) cache with TTL (Time To Live) support.
基于最少使用次数进行淘汰,并为每个元素设置生存时间。 Evicts items with the lowest access frequency, each item having a time-to-live.