OptionalonExpire: SessionExpirationCallback<Types>ReadonlysizeThe total number of items held in the cache at the current moment.
Cancel the timer and stop automatically expiring entries. This allows the process to gracefully exit where Timer.unref() is not available.
Clear the cache entirely, throwing away all values.
Deletes a key out of the cache. Returns true if the key was deleted, false otherwise.
Return a value from the cache.
If the key is not found, get() will return undefined.
This can be confusing when setting values specifically to undefined,
as in cache.set(key, undefined). Use cache.has() to determine
whether a key is present in the cache at all.
Optionaloptions: GetOptionsReturns all active sessions whose constructor matches the given one.
This includes sessions of subclasses. Useful for querying sessions of a specific type without iterating the entire repository.
ProtectedgetReturns the session's constructor and every parent constructor, so subclasses are found by their parents.
Return the remaining time before an item expires. Returns 0 if the item is not found in the cache or is already expired.
Returns the remaining TTL of the given session.
Check if a key is in the cache. Will return false if the item is stale, even though it is technically in the cache.
Return a generator yielding the keys in the cache, from soonest expiring to latest expiring.
Called when the bot is started.
Called when the bot is stopped.
Delete any stale entries. Returns true if anything was removed, false otherwise.
Add a value to the cache.
Optionaloptions: SetOptionsSets a callback that will be called when a session expires.
Set the ttl explicitly to a value, defaulting to the TTL set on the ctor
Optionalttl: numberStaticcreateOptionalonExpire: SessionExpirationCallback<Types>
An object for temporal storage of Session instances.