matthewrudy / rudeq
- Source
- Commits
- Network (6)
- Issues (0)
- Downloads (1)
- Wiki (1)
- Graphs
-
Branch:
master
rudeq / README
| 37ed6f29 » | matthewrudy | 2008-06-19 | 1 | == Author | |
| 2 | Matthew Rudy Jacobs | ||||
| 3 | |||||
| 4 | == Contact | ||||
| 5 | MatthewRudyJacobs@gmail.com | ||||
| 6 | |||||
| 7 | RudeQ | ||||
| 8 | ============= | ||||
| 9 | A simple DB based queue, | ||||
| 10 | designed for situations where a server based queue is unnecessary. | ||||
| 11 | |||||
| 12 | |||||
| 13 | INSTALL | ||||
| 14 | ============ | ||||
| 15 | This plugin requires Rails 2.* currently, and has only been tested on MySQL. | ||||
| 16 | |||||
| a2c66975 » | matthewrudy | 2008-06-19 | 17 | On rails 2.1 you can install straight from github: | |
| 37ed6f29 » | matthewrudy | 2008-06-19 | 18 | ruby script/plugin install git://github.com/matthewrudy/rudeq.git | |
| a2c66975 » | matthewrudy | 2008-06-19 | 19 | ||
| 20 | Else just check it out into your plugins directory: | ||||
| 21 | git clone git://github.com/matthewrudy/rudeq.git vendor/plugins/rudeq | ||||
| 37ed6f29 » | matthewrudy | 2008-06-19 | 22 | ||
| 23 | USAGE | ||||
| 24 | ============ | ||||
| 25 | After you've installed it just run | ||||
| 26 | rake queue:setup | ||||
| 27 | |||||
| 28 | matthew@iRudy:~/code/jbequeueing $ rake queue:setup | ||||
| 29 | (in /Users/matthew/code/jbequeueing) | ||||
| 30 | exists app/models/ | ||||
| 31 | exists spec/fixtures/ | ||||
| 32 | exists spec/models/ | ||||
| 33 | create app/models/rude_queue.rb | ||||
| 34 | create spec/fixtures/rude_queues.yml | ||||
| 35 | create spec/models/rude_queue_spec.rb | ||||
| 36 | exists db/migrate | ||||
| 37 | create db/migrate/029_create_rude_queues.rb | ||||
| 38 | |||||
| 39 | and you're done. | ||||
| 40 | Fully tested, fully index... BOOM! | ||||
| 41 | |||||
| 42 | Now run migrations, start up a console, and; | ||||
| 43 | |||||
| 44 | RudeQueue.set(:queue_name, RandomObject) | ||||
| 45 | RudeQueue.get(:queue_name) | ||||
| d9d4afdd » | matthewrudy | 2009-01-19 | 46 | RudeQueue.fetch(:queue_name) do |data| | |
| 47 | process(data) | ||||
| 48 | end | ||||
| 37ed6f29 » | matthewrudy | 2008-06-19 | 49 | ||
| 50 | And, to keep the queue running fast, | ||||
| 51 | set up a cron job to run | ||||
| 52 | |||||
| 53 | rake queue:cleanup | ||||
| 54 | |||||
| 55 | the cleanup will remove any queued items which have been processed longer than an hour ago. | ||||
| 56 | |||||
| 57 | rake queue:cleanup CLEANUP_TIME=86,400 | ||||
| 58 | |||||
| 59 | will clear processed queue items processed longer than 86,400 seconds ago (1 day) | ||||
| 60 | |||||
| 61 | Try Yourself! | ||||
| 62 | |||||
| 63 | Copyright (c) 2008 [Matthew Rudy Jacobs Email: MatthewRudyJacobs@gmail.com], | ||||
| d9d4afdd » | matthewrudy | 2009-01-19 | 64 | released under the MIT license | |
