Kue
Kue is a Rails ready key value store that uses active-record under the hood.
Build Status
What does Kue mean?
K(eyVal)ue
What about real key value stores?
Redis is awesome! But sometimes you just don't want or need the external dependancy!
How do I install Kue?
Install the gem
gem install kue (command line)
gem 'kue' (gemfile)
Run the generator
rails generate kue:install
rake db:migrate
Use Kue
Set a key and it's value.
KueStore[:any_key_name_you_can_think_of] = "Any object you can dream up"
Get a value by key.
KueStore[:any_key_name_you_can_think_of]
Don't worry it's not just string value's kue can store for you. It's anything!
KueStore[:my_class_instance] = Foo.new(:name => 1)
Find out if a key exists?
KueStore.exists?(:my_class_instance)
Delete a key and it's value
KueStore.delete!(:my_class_instance)
List all the keys in the KueStore
KueStore.keys
Clear all keys and values from the KueStore
KueStore.clear!
Get a count of all the key/value pairs
KueStore.count
Don't like the KueStore class name?
No problem. Just include the Kue::Store module inside of your own class.
class MyStore < ActiveRecord::Base
include Kue::Store
end
MyStore[:all_good] = 1