new LRUCache()
Methods
-
emit(eventName, args)
Utils/classes/LRUCache.ts, line 146 -
Emits an event with the provided arguments.
Name Type Description eventNamestring The name of the event.
argsany repeatable Arguments to pass to the event handlers.
-
get(key)
Utils/classes/LRUCache.ts, line 103 -
Gets the value associated with the key if it exists in the cache and updates it as the most recently used.
Name Type Description keyThe key of the value to get.
Returns:
The value associated with the key, or undefined if the key does not exist. -
off(eventName, callback)
Utils/classes/LRUCache.ts, line 164 -
Removes an event handler. If no callback is provided, removes all handlers for the event.
Name Type Description eventNamestring optional The name of the event.
callbackfunction optional The callback function to remove.
-
on(eventName, callback)
Utils/classes/LRUCache.ts, line 137 -
Registers an event handler that will be invoked every time the event is emitted.
Name Type Description eventNamestring The name of the event.
callbackfunction The callback function to handle the event.
-
once(eventName, callback)
Utils/classes/LRUCache.ts, line 155 -
Registers a one-time event handler that will be invoked only the next time the event is emitted.
Name Type Description eventNamestring The name of the event.
callbackfunction The callback function to handle the event.
-
put(key, value)
Utils/classes/LRUCache.ts, line 117 -
Adds or updates the value in the cache and sets it as the most recently used. Removes the least recently used element if the cache exceeds the established limit.
Name Type Description keyThe key of the value to store.
valueThe value to store.
