I am trying to use beanstalk for queuing a large number of periodic tasks (for example, tasks need processed every N minutes), for each task, if the last queued job is not completed (not reserved, i mean) when current job to be added, the last queued job should be replaced with current job, in other words, only the latest queued job of a task should be processed.
how can i achieve that using beanstalk?
Ideas i have got right now is: for each task, use memcached store its latest timestamps (set this when add jobs to queue), every time the worker reserved a job successfully, it first checks timestamps for this task in memcached, if timestamps of the job is same as timestamps in memcached, then process this job, otherwise skip this job, and delete it from the queue.
So is there better ways to do such work? please give your suggestions, thanks.