jRedis

Extends \Redis

extends the class Redis from the phpredis extension

package

jelix

subpackage

utils

Methods

delete some keys starting by the given prefix

flushByPrefix(string $prefix, integer $maxKeyToDeleteByIter = 3000) 

Warning: use it with caution. This method could consume huge processing time. It is not recommanded to use it during a php request if there are chance that it will delete thousand keys. In this case, prefer to launch it in a separate process (for example in a worker launched by a messaging system like RabbitMQ, Resque..)

Arguments

$prefix

string

$maxKeyToDeleteByIter

integer

the number of keys that are deleted at each iteration To avoid memory issue it deleted keys by pack of $maxKeyToDeleteByIter key. You can change the default number, depending of the memory that the process can use. and the length of keys $maxKeyToDeleteByIter = maxmemory/(average key length+140)