DETS adapter so that we can use dets as a cache
Options
:ram_file(boolean/0) - Enable RAM File The default value isfalse.:type- Data type of DETS cache The default value is:set.:file_path(String.t/0) - File path to save DETS file at The default value is"./".
Summary
Functions
Returns a specification to start this module under a supervisor.
DETS keeps encoding, even though :dets.insert/2 takes terms and would serialise
them itself.
Functions
Returns a specification to start this module under a supervisor.
arg is passed as the argument to Task.start_link/1 in the :start field
of the spec.
For more information, see the Supervisor module,
the Supervisor.child_spec/2 function and the Supervisor.child_spec/0 type.
DETS keeps encoding, even though :dets.insert/2 takes terms and would serialise
them itself.
The reason is the file on disk. Every .dets file written by an earlier version of
this library holds :erlang.term_to_binary/1 blobs as its values. Those files outlive
the upgrade — that is the entire point of a disk cache. If this adapter switched to
native terms, the first read after an upgrade would hand the caller a raw binary where
it expects a term, silently, with no error to trace it back to.
The cost of keeping it is one redundant serialisation of data that is already headed for a disk write, which is dominated by the I/O. The cost of dropping it is corrupting every existing on-disk cache. That trade is not close.