erllama_cache_ram (erllama v0.1.0)

View Source

RAM tier slab store.

Owns the erllama_cache_ram_slabs ETS table. Reads and deletes are direct ETS operations from any process; puts go through this module's put/3 because they need to atomically (a) insert the slab and (b) register the meta row via the meta server.

Slab binaries above 64 bytes live off-heap as refcounted ProcBins so ets:lookup returns a binary reference, not a copy. There is no slab fragmentation to worry about; eviction frees the slab binary by deleting its row.

Summary

Functions

delete(Key)

-spec delete(erllama_cache:cache_key()) -> ok.

handle_call(Msg, From, S)

handle_cast(Msg, S)

-spec handle_cast(term(), term()) -> {noreply, term()}.

init/1

-spec init([]) -> {ok, []}.

load(Key)

-spec load(erllama_cache:cache_key()) -> {ok, binary()} | miss.

put(Key, Slab, Header)

-spec put(erllama_cache:cache_key(), binary(), binary()) -> ok.

size_bytes()

-spec size_bytes() -> non_neg_integer().

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.