Cache
Class responsible for handling the underlying cache for all objects in Discord-Luau.
Entries are evicted explicitly via remove() - callers must call this on DELETE gateway events.
The previous weak-table + TTL-coroutine approach was removed because it could silently evict
entries while they were still valid, and the coroutine workaround that prevented that eviction
made the TTL meaningless.
Properties
Section titled “Properties” Cache.store :: {
{ [K]: V } }
{ [K]: V } }
Methods
Section titled “Methods”Cache : set ( key , value ) -> ()
Stores a value in the cache under the given key.
Parameters
| key: K | |
| value: V |
Cache : get ( key ) -> V?
Returns the cached value for the given key, or nil if not present.
Parameters
| key: K |
Returns
| V? |
remove
Section titled “remove”Cache : remove ( key ) -> ()
Removes the cached value for the given key. Call this on DELETE gateway events to keep the cache consistent with Discord’s state.
Parameters
| key: K |
Functions
Section titled “Functions”Cache . new ( ) -> Cache<K, V>
Constructor for the Cache class.