gacache
Types
Actions are passed to the Cache to interact with it’s Store
pub type Action(value) {
Set(key: Key, value: value)
Get(ret: process.Subject(Result(value, Error)), key: Key)
Clear(key: Key)
Keys(ret: process.Subject(List(Key)))
Reset
Raw(ret: process.Subject(Store(value)))
Merge(store: Store(value))
Stop
}
Constructors
-
Set(key: Key, value: value)
-
Get(ret: process.Subject(Result(value, Error)), key: Key)
-
Clear(key: Key)
-
Keys(ret: process.Subject(List(Key)))
-
Reset
-
Raw(ret: process.Subject(Store(value)))
-
Merge(store: Store(value))
-
Stop
Functions
pub fn clear(cache: Subject(Action(a)), key: String) -> Nil
Removes the Value associated with the provided Key from the Store
pub fn merge(
cache: Subject(Action(a)),
new_store: Dict(String, a),
) -> Nil
Merges the Store with the provided Store using dict:merge/2
pub fn raw(
cache: Subject(Action(a)),
) -> Result(Dict(String, a), Error)
Returns the Store, avoid if possible
pub fn set(
cache: Subject(Action(a)),
key: String,
value: a,
) -> Nil
Updates the Store with key=value