ActiveModel + Redis with the aim to mimic ActiveRecord where possible.
Modis supports CRuby 2.2.2+ and jRuby 9k+
Add this line to your application's Gemfile:
gem 'modis'
And then execute:
$ bundle
Or install it yourself as:
$ gem install modis
class MyModel
include Modis::Models
attribute :name, String
attribute :age, Integer
end
MyModel.create!(:name => 'Ian', :age => 28)
Modis, by default, creates an all
index in redis in which it stores all the IDs for records created. As a result, a large amount of memory will be consumed if many ids are stored. The all
index functionality can be turned off by using enable_all_index
class MyModel
include Modis::Model
enable_all_index false
end
By disabling the all
index functionality, the IDs of each record created won't be saved. As a side effect, using all
finder method will raise a IndexError
exception as we would not have enough information to fetch all records. See rpush#7 for more context.
TODO.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request