Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Sieve_Cache

lock_free.Sieve_Cache

(K 
type
:
property.hashable, V 
type
, capacity i32)
 ref
:
Any
 is
"SIEVE is a cache eviction algorithm that decides what to keep in the cache and what to discard.
It achieves both simplicity and efficiency."
source: https://sievecache.com/
paper : https://junchengyang.com/publication/nsdi24-SIEVE.pdf

example usage:
cache0 := lock_free.Sieve_Cache String i32 3
say <| cache0.access "A" ()->1 # => 1
say <| cache0.access "B" ()->2 # => 2
say <| cache0.access "C" ()->3 # => 3
say <| cache0.access "A" ()->4 # => 1
say <| cache0.access "D" ()->5 # => 5
say <| cache0.access "C" ()->6 # => 3

Type Parameters

Fields

capacity
 i32

Functions

(key K, val Function V)
 => 
V
access stored value for key,
if not in cache, compute and store in cache
 => 
String
[Redefinition of  Any.as_string]
Comment of Any.as_stringcreate a String from this instance. Unless redefined, `a.as_string` will
create `"instance[T]"` where `T` is the dynamic type of `a`

redefines:

(key K)
 => 
option V
get stored value for key k
0.095dev (GIT hash 09dff08de289bbb6f7136c7e2f8c66dcc1856bba)
last changed: 2026-04-16