Simpler Cache v0.1.1 SimplerCache View Source
Simple cache implementation with no locks or other more complicated features.
Link to this section Summary
Functions
Deletes item from cache or does no-op
Returns an item from cache or nil if not found
Gets or stores an item based on a passed in function Warning the below may retry a bit on heavy contention
Inserts new item into cache
Inserts new item or overwrites old item’s value
Sets the ttl to a specific value in ms over 100 for an item
Returns the number of elements in the cache
Updates existing value in cache based on old value Warning the below may retry a bit on heavy contention
Link to this section Types
Link to this section Functions
Deletes item from cache or does no-op
Returns an item from cache or nil if not found
get_or_store(any(), fallback_function()) :: any()
Gets or stores an item based on a passed in function Warning the below may retry a bit on heavy contention
Inserts new item into cache
Inserts new item or overwrites old item’s value
set_ttl_ms(any(), pos_integer()) :: {:ok, :updated} | {:error, :failed_to_update_element} | {:error, any()}
Sets the ttl to a specific value in ms over 100 for an item
Returns the number of elements in the cache
update_existing(any(), update_function()) :: {:ok, :updated} | {:error, :failed_to_find_entry}
Updates existing value in cache based on old value Warning the below may retry a bit on heavy contention