I am new to redis and predis. I want to create a simple sign up form and want to send data to user email id. I have written the script for sign up and email sending. Now I want to make a queue in which i want to put both of the jobs. and as the user click on submit then processor should not wait for sending email. sending email should be put in a queue. and should be processed in background. please guys can anyone give me a reference of such script in php using redis.
-
You can put your tasks into redis and iterate over it using cron or you can use celeryAlexander Larikov– Alexander Larikov2012-08-22 06:17:53 +00:00Commented Aug 22, 2012 at 6:17
Add a comment
|
1 Answer
What you can do is, push the data to a redis list and pick data from the worker which is polling the list for any data and then send it by email.
Steps:
Make a new predis client $redis = new Predis\Client("parameter");
A predis list $redis->lpush(listname, "Data");
and finally a worker(Cron) which is taking data from the same list
$redis->rpop(listname, variable);
Other work around way is to use pub/sub of redis.
Try redis here and documentation- redis commands
Predis examples. In examples folder.
4 Comments
Rohitashv Singhal
hey amit. i have done the basic things but i am not getting how to start with these things. is there any tutorial from where i can start begining
Rohitashv Singhal
is there any example from where i can learn that how the things are going on
amitchhajer
you can start with redis here
http://try.redis-db.com/ and there are redis commands here http://redis.io/commands . Try working with redis-cli first, predis is just a php implementation of redis.amitchhajer
predis
https://github.com/nrk/predis have a lot of examples in examples folder. Check that out too.