Revision 9330
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sh/util.sh | ||
---|---|---|
71 | 71 |
|
72 | 72 |
## shell-variable-based caching |
73 | 73 |
|
74 |
# usage: local cache_key=...; cache_init; \
|
|
75 |
# if ! cached; then cache_save value; fi; echo_cached_value
|
|
74 |
# usage: local cache_key=...; load_cache; \
|
|
75 |
# if ! cached; then save_cache value; fi; echo_cached_value
|
|
76 | 76 |
# cache_key for function inputs: "$(declare -p "$kw_param"...) $*" |
77 | 77 |
alias load_cache='declare cache_var="$(str2varname "${FUNCNAME}___$cache_key")"' |
78 | 78 |
alias cached='isset "$cache_var"' |
Also available in: Unified diff
lib/sh/util.sh: shell-variable-based caching: usage: updated alias names