NervesFlutterSupport.DownloadCache (nerves_flutter_support v1.3.0)
A utility module to help cache and fetch cached data from a known cache namespace.
Summary
Functions
Attempts to delete the download cache directory.
Given a cache key (sha256 hash) this function attempts to find the matching data
in the on-disk cache. If the file isn't found, returns :miss
.
Takes in a key (binary) and data (binary) and writes it to the cache on disk.
Functions
@spec clear_cache() :: :ok | {:error, term()}
Attempts to delete the download cache directory.
Given a cache key (sha256 hash) this function attempts to find the matching data
in the on-disk cache. If the file isn't found, returns :miss
.
If the cache data is found, {:hit, data}
is returned.
Other error conditions will return an error tuple.
Takes in a key (binary) and data (binary) and writes it to the cache on disk.
Can return an error tuple if a write fails.