package core:container/lru

Index

Types (2)
Constants (0)

This section is empty.

Variables (0)

This section is empty.

Procedure Groups (0)

This section is empty.

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.

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 :: proc "odin" (c: ^$C/Cache($Key, $Value), call_on_remove: bool) {…}
 

clear the contents of a Cache

destroy ¶

destroy :: proc "odin" (c: ^$C/Cache($Key, $Value), call_on_remove: bool) {…}
 

destroy deinitializes a Cachem

exists ¶

exists :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $) -> bool {…}
 

exists checks for the existence of a value from a given key without updating the recent usage.

get ¶

get :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $) -> (value: $, ok: bool) #optional_ok {…}
 

get a value from the cache from a given key. This operation updates the usage of the item.

get_ptr ¶

get_ptr :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $) -> (value: ^$, ok: bool) #optional_ok {…}
 

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 "odin" (c: ^$C/Cache($Key, $Value), capacity: int, entries_allocator := context.allocator, node_allocator := context.allocator) {…}
 

init initializes a Cache

peek ¶

peek :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $) -> (value: $, ok: bool) #optional_ok {…}
 

peek gets the value from the cache from a given key without updating the recent usage.

remove ¶

remove :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $) -> bool {…}
 

remove removes an item from the cache.

set ¶

set :: proc "odin" (c: ^$C/Cache($Key, $Value), key: $, value: $) -> 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-2022-12 (vendor "odin") Windows_amd64 @ 2022-12-06 21:08:55.149165600 +0000 UTC