erllama_cache_ramfile_srv (erllama v0.1.0)

View Source

RAM-file tier server.

Identical mechanics to erllama_cache_disk_srv (same KVC framing, same temp+datasync+link+fsync_dir publish protocol) — the only difference is the root directory points at a tmpfs mount such as /dev/shm so the bytes never touch a spinning disk. The tier label ram_file is what the meta server records, which lets the scheduler reason about durability separately from latency.

Implementation is a delegating wrapper; all real work lives in erllama_cache_disk_srv.

Summary

Functions

delete(SrvName, Key)

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

dir(SrvName)

-spec dir(atom()) -> file:name().

load(SrvName, Key)

-spec load(atom(), erllama_cache:cache_key()) ->
              {ok, erllama_cache_kvc:info(), binary()} | miss | {error, term()}.

save(SrvName, BuildMeta, Payload)

-spec save(atom(), erllama_cache_kvc:build_meta(), binary()) ->
              {ok, erllama_cache:cache_key(), binary(), non_neg_integer()} | {error, term()}.

scan(SrvName)

-spec scan(atom()) -> [{erllama_cache:cache_key(), binary(), non_neg_integer()}].

start_link(Name, RootDir)

-spec start_link(atom(), file:name()) -> {ok, pid()} | {error, term()}.