Skip to content
This repository

Que system based on memcachedb and memcachedb-client

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README
MemcacheDB Que system.

example for adding a runner to the que

que = MemcachedbQ.new(:notices) #uses the :notices que
que.add_runner(:notifier, :deliver_customer_order, order.id) #adds a runner
    # in this case :notifier relates to an actionmailer class
    # :deliver_customer_order is a method within that class
    # and the order.id is the value passed along to that method.
    # at this point the information should be in the memcachedb
    # if for some reason adding the runner fails it should 
    # immediately run the class.method(value) combination
que.run
    # que.run is used to fork a process to handle the specific :notices runner que
    # it checks before forking if there is anything to run, or if a process
    # is already running a forked que for notices
    # also instead of using que.run, you can just run the rake task to handle all
    # runners in the config file. the simplest way is to setup a cronjob to run
    # every minute. At the most you will only have as many forked processes as 
    # there are ques


added option to repeat runners.

que.add_runner(:notifier, :deliver_customer_order, order.id, :repeats=>30)

:repeats is in seconds
must use :repeat_name for repeats

this will add a new runner just before running the existing job. If you originally set a time to run then it will add to that time with repeats. If no :run_time was set it will set a run time of Time.now when it runs for the first time.
Something went wrong with that request. Please try again.