Tuesday 23 May 2017

How do i set a value as a list for a particular key in redis?

I had to check if i can put expire on a list which is value to a key. for this i can do the following.

rpush mylist 1 2 3
> prints 1 2 3
set key mylist
> prints "ok"
expire key 5
>prints "(integer) 1"

this would only expire the connection between key and mylist

get key
>prints (nil)

would result in a null. but the list (mylist here) exists

lrange mylist 0 -1
> prints "1 2 3"

prints all values in the list. i want the list to be destroyed. how do i do it in commandline or nodeJS?



via The-Higgs-Boson

No comments:

Post a Comment