View Source filezcache (filezcache v2.2.1)
Filezcache api, insert, lookup, stream and delete cached files.
Summary
Functions
Save access time as a information in the datastore.
Append to existed stream.
Return checksum.
Return the directory for the storage of the cached files.
Delete data item for the storage.
Finish existed stream.
Equivalent to insert(Key, Bin, []).
Insert binary value and options.
Equivalent to insert_file(Key, FilePath, []).
Insert file and options.
Equivalent to insert_stream(Key, undefined, []).
Insert stream.
Insert stream.
Equivalent to insert_tmpfile(Key, FilePath, []).
Insert temporary file and options.
Return the directory for the storage of the log/journal
files.
Try to find monitor by Key.
Lookup datastore element by Key. Either returns the file in the filecache or a device pid to read from. The file is returned if the cache entry is complete, the device is returned if the cache entry is being written to. Read the device using file:read(Pid, Length).
Lookup datastore element by Pid or Key and options.
Lookup File by Key.
Lookup Pid and options.
Return data storade information.
Check existence of Key in the data storage.
Functions
-spec access(Key) -> Result when Key :: term(), Result :: ok.
Save access time as a information in the datastore.
Append to existed stream.
-spec checksum(Filename) -> Result when Filename :: file:filename_all(), Result :: binary().
Return checksum.
-spec data_dir() -> Result when Result :: file:filename_all().
Return the directory for the storage of the cached files.
-spec delete(Key) -> Result when Key :: term(), Result :: ok | {error, Reason}, Reason :: lockedlog_a | writing | active.
Delete data item for the storage.
-spec finish_stream(Pid) -> Result when Pid :: pid(), Result :: ok.
Finish existed stream.
-spec insert(Key, Bin) -> Result when Key :: term(), Bin :: binary(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Equivalent to insert(Key, Bin, []).
Insert binary value.
-spec insert(Key, Bin, Opts) -> Result when Key :: term(), Bin :: binary(), Opts :: list(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Insert binary value and options.
-spec insert_file(Key, FilePath) -> Result when Key :: term(), FilePath :: file:filename_all(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Equivalent to insert_file(Key, FilePath, []).
Insert file.
-spec insert_file(Key, FilePath, Opts) -> Result when Key :: term(), FilePath :: file:filename_all(), Opts :: list(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Insert file and options.
-spec insert_stream(Key) -> Result when Key :: term(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Equivalent to insert_stream(Key, undefined, []).
Insert stream.
-spec insert_stream(Key, FinalSize, Opts) -> Result when Key :: term(), FinalSize :: non_neg_integer() | undefined, Opts :: list(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Insert stream.
-spec insert_stream(Key, FinalSize, StreamFun, Opts) -> Result when Key :: term(), FinalSize :: non_neg_integer() | undefined, StreamFun :: function(), Opts :: list(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Insert stream.
-spec insert_tmpfile(Key, FilePath) -> Result when Key :: term(), FilePath :: file:filename_all(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Equivalent to insert_tmpfile(Key, FilePath, []).
Insert temporary file.
-spec insert_tmpfile(Key, FilePath, Opts) -> Result when Key :: term(), FilePath :: file:filename_all(), Opts :: list(), Result :: {ok, Pid} | {error, Reason}, Pid :: pid(), Reason :: term().
Insert temporary file and options.
-spec journal_dir() -> Result when Result :: file:filename_all().
Return the directory for the storage of the log/journal
files.
-spec locate_monitor(Key) -> Result when Key :: term(), Result :: {ok, {file, FileSize, Filename}} | {ok, {pid, pid()}} | {error, Reason}, FileSize :: non_neg_integer(), Filename :: file:filename_all(), Reason :: enoent.
Try to find monitor by Key.
-spec lookup(Key) -> Result when Key :: term(), Result :: {ok, {file, FileSize, Filename}} | {ok, {device, Pid}} | {error, term()}, FileSize :: non_neg_integer(), Filename :: file:filename_all(), Pid :: file:io_device().
Lookup datastore element by Key. Either returns the file in the filecache or a device pid to read from. The file is returned if the cache entry is complete, the device is returned if the cache entry is being written to. Read the device using file:read(Pid, Length).
-spec lookup(PidOrKey, Opts) -> Result when PidOrKey :: pid() | term(), Opts :: list(), Result :: term().
Lookup datastore element by Pid or Key and options.
-spec lookup_file(Key) -> Result when Key :: term(), Result :: {ok, {file, FileSize, Filename}} | {error, Reason}, FileSize :: non_neg_integer(), Filename :: file:filename_all(), Reason :: enoent.
Lookup File by Key.
-spec lookup_file(PidOrKey, Opts) -> Result when PidOrKey :: pid() | term(), Opts :: list(), Result :: {ok, {file, FileSize, Filename}} | {error, Reason}, FileSize :: non_neg_integer(), Filename :: file:filename_all(), Reason :: enoent.
Lookup Pid and options.
-spec stats() -> Stats when Stats :: #{bytes := non_neg_integer(), max_bytes := non_neg_integer(), processes := non_neg_integer(), entries := non_neg_integer(), referrers := non_neg_integer(), gc_candidate_pool := list(), insert_count := non_neg_integer(), delete_count := non_neg_integer(), hit_count := non_neg_integer(), miss_count := non_neg_integer(), evict_count := non_neg_integer()}.
Return data storade information.
Check existence of Key in the data storage.