In addition to a GUI, Python and REST APIs, it is now possible to access your Zato caches from command line. Learn from this article how to quickly check, set and delete keys in this way - particularly useful for remote SSH connections to Zato environments.
Prerequisites
This functionality will be released in Zato 3.2 (June 2020) - right now, if you would like to use it, Zato needs to be installed from source.
In web-admin
First, let us create a couple of new keys in the GUI - my.key and my.key2 - to work with them later on from command line.
Command line
Now, we can get, set and delete the keys using the CLI. Observe the below and notice that set and delete commands not only carry out what they ought to but they also return the previous value of a given key.
$ zato cache get my.key --path /path/to/server1 ; echo
{"value": "my.value"}
$
$ zato cache get my.key2 --path /path/to/server1 ; echo
{"value": "my.value2"}
$
$ zato cache set my.key my.new.value --path /path/to/server1 ; echo
{"prev_value": "my.value"}
$
$ zato cache delete my.key2 --path /path/to/server1 ; echo
{"prev_value": "my.value2"}
$ zato cache set my.key3 my.value3 --path /path/to/server1 ; echo
{}
$
Back to web-admin
The last command created a new key - we can confirm its existence in web-admin:
Summary
That it is all - as simple as possible, just log in to an SSH server, point your command line to Zato and you can access your caches right away.
from Planet Python
via read more
No comments:
Post a Comment