Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 state

Back to all declarations

capacity

untyped bigint

capacity is the fixed maximum number of entries the cache holds.

Value

(8 <untyped> bigint)

node

type

node is a doubly-linked-list node holding a key/value pair. The list is ordered MRU (head) -> LRU (tail).

Value

v0.node

cache

type

cache is a fixed-capacity LRU cache backed by a doubly-linked list and an index from key -> node for O(1) lookups.

Value

v0.cache

Put

func(key string, value string)

Put inserts or updates key with value and marks it most-recently-used. Evicts the least-recently-used entry if capacity is exceeded.

Open
OID
0d7dd2…3279:7
Put details

Inspect func

Get

func(key string) (string, bool)

Get returns the value for key and marks it most-recently-used. It records a hit or a miss. The returned bool reports whether the key was present.

Open
OID
0d7dd2…3279:9
Get details

Inspect func

Reset

func()

Reset clears the cache and stats.

Open
OID
0d7dd2…3279:10
Reset details

Inspect func

peek

func(key string) (string, bool)

peek returns the value without affecting recency or stats (read helper).

Open
OID
0d7dd2…3279:11
peek details

Inspect func

Render

func(path string) string

Render displays the cache contents in MRU->LRU order with stats.

Open
OID
0d7dd2…3279:12
Render details

Inspect func
capacity : untyped bigint =(8 <untyped> bigint)
node : type =v0.node
cache : type =v0.cache
c : *v0.cache Inspect
Put : func(key string, value string) Inspect
Get : func(key string) (string, bool) Inspect
Reset : func() Inspect
peek : func(key string) (string, bool) Inspect
Render : func(path string) string Inspect