Answer the question
In order to leave comments, you need to log in
How to implement a queue with Redis runtime?
It is necessary to implement a queue on Redis and not a simple one, but with an indication of the time for performing certain operations. The study of the problem showed that in Redis it is possible to set the lifetime of the key ( EXPIRE ), but how to make a callback to this event?
Or maybe this problem should be solved in some other way?
Answer the question
In order to leave comments, you need to log in
redis.io/topics/notifications
SET notify-keyspace-events Ex
SUBSRCIBE [email protected]__:expired
$redisSub = new Redis() or die("Can't create to redis database instance!\n");
$redisSub->connect('localhost', 6379) or die("Can't connect to redis database!\n");
$redisSub->select(2) or die("Can't select database!\n");
$redisSub->setOption(Redis::OPT_READ_TIMEOUT, -1);
$redisSub->config('SET', 'notify-keyspace-events', 'Ex');
$redisSub->subscribe(['[email protected]__:expired'], 'msg'); // db 2
function msg($redisSub, $chan, $msg) {
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question