Something went wrong. Try again.
📦➔🦋 Store and retrieve files on the Atmosphere
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445#!/usr/bin/env bash
function atfile.cache.debug() { key="$1" action="$2" output="$3"
[[ -z "$output" ]] && output="(Empty)"
atfile.say.debug "$action '$key' cache...\n↳ $output"}
function atfile.cache.del() { key="$1"
key_path="$(atfile.util.get_cache_path "$key")"
atfile.cache.debug "$key" "Deleting" [[ -f "$key_path" ]] && rm "$key_path"}
function atfile.cache.get() { key="$1" unset value
key_path="$(atfile.util.get_cache_path "$key")"
[[ -f "$key_path" ]] && value="$(cat "$key_path")" atfile.cache.debug "$1" "Getting" "$value" echo "$value"}
function atfile.cache.set() { key="$1" value="$2"
# shellcheck disable=SC2154 mkdir -p "$_path_cache" key_path="$(atfile.util.get_cache_path "$key")"
atfile.cache.debug "$key" "Setting" "$value" echo "$value" > "$key_path" echo "$value"}