Jelix 1.6.37

jRedis extends Redis
in package

extends the class Redis from the phpredis extension

Tags
subpackage

utils

Table of Contents

flushByPrefix()  : mixed
delete some keys starting by the given prefix

Methods

flushByPrefix()

delete some keys starting by the given prefix

public flushByPrefix(string $prefix[, int $maxKeyToDeleteByIter = 3000 ]) : mixed

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..)

Parameters
$prefix : string
$maxKeyToDeleteByIter : int = 3000

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)

Return values
mixed

Search results