Keeps rendered audio on disk, keyed by name and fingerprint, in a directory the caller names — an application keeps its own — or this library's own when none is.
Cache.fetch("dusk", Cache.fingerprint(MyApp.Music), fn -> render() end, dir: "~/.cache/myapp/music")
Summary
Functions
Remove the cache directory and everything in it, whatever fingerprint it was stored under.
The directory audio is kept in: $XDG_STATE_HOME/tuning_fork, or
~/.local/state/tuning_fork when that is unset or relative.
The stored audio for key, rendering and storing it when there is none.
A fingerprint of module, as a hexadecimal string.
Where key at fingerprint is kept, under dir (default dir/0).
Functions
@spec clear() :: :ok
Remove the cache directory and everything in it, whatever fingerprint it was stored under.
@spec dir() :: Path.t()
The directory audio is kept in: $XDG_STATE_HOME/tuning_fork, or
~/.local/state/tuning_fork when that is unset or relative.
The stored audio for key, rendering and storing it when there is none.
key names the audio and may contain path separators. fingerprint is any string that
changes when the rendered result should change. render is called only on a miss, and its
binary is both stored and returned; an earlier fingerprint of the same key is removed. A
store that fails is logged at debug level and the binary is still returned. :dir is
the directory to keep it in, default dir/0.
A fingerprint of module, as a hexadecimal string.
Changes when the compiled code of module, TuningFork.Voice or TuningFork.Mixer changes.
Where key at fingerprint is kept, under dir (default dir/0).