File utils/blockedcache.lua
Functions
BlockedCache:clear () | Clears the complete cache. |
BlockedCache:compact (max_entries) | Compacts the cache, meaning it removes the oldest entries up to the maximum number of entries. |
BlockedCache:get (x, z) | Gets the value associated with the given x and z coordinates. |
BlockedCache:is_cached (x, z) | Gets if there is a cache entry associated with the given x and z coordinates. |
BlockedCache:new (max_entries, auto_compact) | Creates a new instance of BlockedCache. |
BlockedCache:to_string () | Gets a string representation of this cache. |
Functions
- BlockedCache:clear ()
- Clears the complete cache.
- BlockedCache:compact (max_entries)
-
Compacts the cache, meaning it removes the oldest entries up to the maximum number of entries.
Parameters
- max_entries: Optional. The maximum number of cache entries to preserve.
- BlockedCache:get (x, z)
-
Gets the value associated with the given x and z coordinates.
Parameters
- x: The x coordinate.
- z: The z coordinate.
Return value:
The value associated with the given x and z coordinates. Returns nil if there is no entry. - BlockedCache:is_cached (x, z)
-
Gets if there is a cache entry associated with the given x and z coordinates.
Parameters
- x: The x coordinate.
- z: The z coordinate.
Return value:
true if there is an entry for the given coordinates. - BlockedCache:new (max_entries, auto_compact)
-
Creates a new instance of BlockedCache.
Parameters
- max_entries: Optional. The maximum entries for the cache which will be preserved if the cache is compacted, defaults to 12.
- auto_compact: Optional. If the cache performs automatic compaction if the maximum numbers of entries is reached, defaults to true.
Return value:
A new instance of BlockedCache. - BlockedCache:to_string ()
-
Gets a string representation of this cache.
Return value:
The string representation.