Question

I am new to jedis. I am not able to distinguish del() and flushAll(). Does del() deletes the keys from cache or from database. Kindly provide some details. Please note, I did try to search for an answer on the web, but could't fine my answer.

Thank you.

Était-ce utile?

La solution

DEL: Deletes a single key

redis 127.0.0.1:6379[1]> SET foo bar
OK
redis 127.0.0.1:6379[1]> SET XXX YYY
OK
redis 127.0.0.1:6379[1]> keys *
1) "XXX"
2) "foo"
redis 127.0.0.1:6379[1]> DEL foo
(integer) 1
redis 127.0.0.1:6379[1]> keys *
1) "XXX"

FLUSHALL Redis has 12 Database by default you can choose a database by SELECT command

redis 127.0.0.1:6379[1]> SELECT 11

IMPORTANT TO REMEMBER IF YOU USE FLUSHALL COMMAND IT WILL DELETE DATA FROM ALL 12 DATABASES

FLUSHDB: Deletes all keys from CURRENT database. May be you would like to use it in 90% of cases instead of FLUSHALL

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top