Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/velo/src/cache/capabilities/expire_capability.ts>ExpireCapability

A high-performance caching library for Deno. Supports LRU, LFU, ARC, and TinyLFU.
Latest
class ExpireCapability
extends CapabilityWrapper<K, V>
import { ExpireCapability } from "https://deno.land/x/velo@1.0.0/src/cache/capabilities/expire_capability.ts";

Adds expiration of entries to a cache. Uses a TimerWheel to add, manage, and remove expiration timers. Overwrites methods to advance the timer wheel and passes the rest through to the inner cache.

Constructors

new
ExpireCapability(
inner: Cache<K, V> & CacheInternal<K, V>,
ttl: number,
options: ExpireOptions,
)

Properties

private
nodeMap: Map<K, TimerNode<K, V>>
private
onExpireFunction: OnExpire<K, V>
private
retiredNodes: TimerNode<K, V>[]
private
timerWheel: TimerWheel<K, V>
private
ttl: number
private
ttlOptions: ExpireOptions

Methods

forEach(callback: (item: { key: K; value: V; }, index?: number) => void): void
get(key: K): V | undefined
has(key: K): boolean
peek(key: K): V | undefined
remove(key: K): void
reset(): void
set(key: K, value: V): void
setWithExpire(
key: K,
value: V,
ttl: number,
)