šŸ“¦āž”šŸ¦‹ Store and retrieve files on the Atmosphere
34
fork

Configure Feed

Select the types of activity you want to include in your feed.

at dev 44 lines 899 B view raw
1#!/usr/bin/env bash 2 3function atfile.cache.debug() { 4 key="$1" 5 action="$2" 6 output="$3" 7 8 [[ -z "$output" ]] && output="(Empty)" 9 10 atfile.say.debug "$action '$key' cache...\n↳ $output" 11} 12 13function atfile.cache.del() { 14 key="$1" 15 16 key_path="$(atfile.util.get_cache_path "$key")" 17 18 atfile.cache.debug "$key" "Deleting" 19 [[ -f "$key_path" ]] && rm "$key_path" 20} 21 22function atfile.cache.get() { 23 key="$1" 24 unset value 25 26 key_path="$(atfile.util.get_cache_path "$key")" 27 28 [[ -f "$key_path" ]] && value="$(cat "$key_path")" 29 atfile.cache.debug "$1" "Getting" "$value" 30 echo "$value" 31} 32 33function atfile.cache.set() { 34 key="$1" 35 value="$2" 36 37 # shellcheck disable=SC2154 38 mkdir -p "$_path_cache" 39 key_path="$(atfile.util.get_cache_path "$key")" 40 41 atfile.cache.debug "$key" "Setting" "$value" 42 echo "$value" > "$key_path" 43 echo "$value" 44}