Reputation: 4936
I am running two instance of my php application, one is live and one is beta. i am using redis in my live server for caching data. i am storing article category as key and article id as values.
Recently by mistake i connected my beta server with the redis and it has messed redis cache. i mean it has added some other article ids in wrong keys. so now i started getting wrong data from redis.
my question is
"is there any way to clear only values of the redis keys?"
i don't want to clear keys but only values of it.
i had gone through redis document and i found flushAll, del etc.. but based on doc it will delete my keys also it seems.
i am using predis php library to communicate with redis server.
can anybody help me to delete only values from redis server.
Upvotes: 1
Views: 5502
Reputation: 49942
When you "clear" the value of a key, Redis will remove the key. Put differently, you can't have keys with no values.
Upvotes: 1
Reputation: 648
try to use this function
$redis->mset(array('key0' => '', 'key1' => ''));
Upvotes: 0