The 'cache' Command - jmadison222/jamaratus GitHub Wiki
Manage cache files across other components.
> cache help
Manage cache files at the user account level on the current server.
Often you would like your shell scripts and functions to remember your
preferences. The 'cache' command does that. It writes the preferences
to the home directory of the current user. The reason this is useful
is that you often run many sessions as the same user on the same
machine, and you want those preferences across those sessions.
The 'set' action will create the cache file if it does not exist. This
saves us from needing an independent creation command, but means that if
you make a mistake with a 'set', you have to fix the mistake by manually
deleting the cache file.
The [value] can be blank as a legitimate value to store. Do this with
quotes so there is no ambiguity.
Examples:
cache get foo bar # Returns: Cache not found for foo bar.
cache default foo bar one
cache get foo bar # Returns: one
cache set foo bar two
cache get foo bar # Returns: two
cache default foo bar three # Note it doesn't overwrite.
cache get foo bar # Returns: two
cache set foo bar # Clears the value, but keeps the key.
cache get foo bar # Returns: <blank>
cache unset foo bar # Clears the key too.
# This next one sounds negative, but it's actually what we want.
cache get foo bar # Returns: Cache not found for foo bar.
Usage: cache <action:help> # Where action is:
default <sol> <item> [value] Set the cache but don't overwrite it.
flush Delete all cache files.
help Help by showing these instructions. [default]
get <sol> <item> Get the <value> stored in <item> for the <sol>ution.
set <sol> <item> [value] Put the <value> as the <item> for the <sol>ution.
show [sol] Show cache files and contents filtered on [sol].
unset <sol> <item> Delete the cache file for <item> for the <sol>ution.