package core:container/lru
Types
Cache ¶
Cache :: struct($Key: typeid, $Value: typeid) where intrinsics.type_is_valid_map_key(Key) {}
Cache is an LRU cache. It automatically removes entries as new entries are added if the capacity is reached. Entries are removed based on how recently they were used where the oldest entries are removed first.
Related Procedures With Parameters
Node ¶
Node :: struct($Key: typeid, $Value: typeid) where intrinsics.type_is_valid_map_key(Key) {}
Constants
This section is empty.
Variables
This section is empty.
Procedures
clear ¶
clear the contents of a Cache
destroy ¶
destroy deinitializes a Cachem
exists ¶
exists checks for the existence of a value from a given key without updating the recent usage.
get ¶
get a value from the cache from a given key. This operation updates the usage of the item.
get_ptr ¶
get_ptr gets the pointer to a value the cache from a given key. This operation updates the usage of the item.
init ¶
init :: proc(c: ^$C/Cache($Key, $Value), capacity: int, entries_allocator := context.allocator, node_allocator := context.allocator) {…}
init initializes a Cache
peek ¶
peek gets the value from the cache from a given key without updating the recent usage.
remove ¶
remove removes an item from the cache.
set ¶
set :: proc(c: ^$C/Cache($Key, $Value), key: $T, value: $T) -> runtime.Allocator_Error {…}
set the given key value pair. This operation updates the recent usage of the item.
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-20 21:10:45.847492400 +0000 UTC