extends the class Redis from the phpredis extension.
- flushByPrefix() : mixed
- delete some keys starting by the given prefix.
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..)
- $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)