๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere
34
fork

Configure Feed

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

add debug messages for cache

Ducky 226e3498 5d9c9cda

+18 -1
+18 -1
src/shared/cache.sh
··· 1 1 #!/usr/bin/env bash 2 2 3 + function 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 + 3 13 function atfile.cache.del() { 4 14 key="$(atfile.util.get_cache_path "$1")" 15 + 16 + atfile.cache.debug "$1" "Deleting" 5 17 [[ -f "$key" ]] && rm "$key" 6 18 } 7 19 8 20 function atfile.cache.get() { 9 21 key="$(atfile.util.get_cache_path "$1")" 10 - [[ -f "$key" ]] && cat "$key" 22 + unset value 23 + 24 + atfile.cache.debug "$1" "Getting" "$value" 25 + [[ -f "$key" ]] && value="$(cat $key)" 26 + echo "$value" 11 27 } 12 28 13 29 function atfile.cache.set() { 14 30 key="$(atfile.util.get_cache_path "$1")" 15 31 value="$2" 16 32 33 + atfile.cache.debug "$1" "Setting" "$value" 17 34 # shellcheck disable=SC2154 18 35 mkdir -p "$_path_cache" 19 36 echo "$value" > "$key"