* Zsh plugin – redis database keys mapper (to Zsh variables)
@ 2017-06-01 7:41 Sebastian Gniazdowski
0 siblings, 0 replies; only message in thread
From: Sebastian Gniazdowski @ 2017-06-01 7:41 UTC (permalink / raw)
To: zsh-users
Hello
I've released a plugin, maybe it fits upstream? It binds redis keys to shell parameters. For example:
% redis-cli -n 3 hmset HASHSET field1 value1 fld2 val2
% zrtie -d db/redis -f "127.0.0.1/3/HASHSET" hset
% echo ${(kv)hset}
field1 value1 fld2 val2
The point is that this is miles away from redis-cli usage. For example, to copy one hash to another:
% zrtie -r -d db/redis -f "127.0.0.1/3/HASHSET1" hset1 # -r - read-only
% zrtie -d db/redis -f "127.0.0.1/3/HASHSET2" hset2
% hset2=( "${(kv)hset1[@]}" )
To generate multiple keys for sorted set:
% zrtie -d db/redis -f "127.0.0.1/3/NEWZSET" zset
% for i in {a..z} {A..Z}; do
> zset[$i]=$count;
> done
To remove list element:
% redis-cli -n 4 rpush LIST value1 value2 value3
% zrtie -d db/redis -f "127.0.0.1/4/LIST" mylist
% mylist=( 1 2 3 )
% mylist[2]=()
% redis-cli -n 4 lrange LIST 0 -1
1) "1"
3) "3"
All that is needed to compile is `hiredis` C library.
Project page: https://github.com/zdharma/zredis
--
Sebastian Gniazdowski
psprint /at/ zdharma.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-01 7:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-01 7:41 Zsh plugin – redis database keys mapper (to Zsh variables) Sebastian Gniazdowski
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).