Cachex v2.1.0 Cachex.Disk
This module contains interaction with disk for serializing terms directly to a given file path. This is mainly used for backing up a cache to disk in order to be able to export a cache to another instance. Writes can have a compression attached and will add basic compression by default.
Summary
Functions
Reads a file back into an Erlang term.
If there’s an error reading the file, or the file is invalid ETF, an error will be returned. Otherwise an :ok Tuple containing the terms will be returned.
As we can’t be certain what we’re reading from the file, we make sure to load it safely to avoid malicious content (although the chance of that is slim).
Writes a set of Erlang terms to a location on disk.
We allow the user to pass a :compression option in order to reduce the output,
but by default we’ll compress using level 1 compression. If the :compression
is set to 0 then compression will be disabled, but be aware storage will
increase dramatically.