This plug-in caching mechanism to implement the Model of the Sequel
Ruby
Latest commit 4dc01c3 Jun 27, 2013 @rosylilly Version bump: 1.1.0
Permalink
Failed to load latest commit information.
lib Version bump: 1.1.0 Jun 27, 2013
spec Fixing the "destory" typo in both the spec and instance methods. Jun 21, 2013
.document Initial commit to sequel-cacheable. Feb 26, 2012
.gitignore Clear all Dec 30, 2012
.pryrc 大規模刷新 Dec 30, 2012
.rbenv-version
.rspec guard init Feb 26, 2012
.travis.yml Add testing target ruby version: 2.0.0 Jun 27, 2013
Gemfile Change gem source from :rubygems to secure rubygems Jun 27, 2013
Guardfile guard init Feb 26, 2012
LICENSE.txt Initial commit to sequel-cacheable. Feb 26, 2012
Procfile
README.rdoc Update README Dec 30, 2012
Rakefile Clear all Dec 30, 2012
sequel-cacheable.gemspec Clear all Dec 30, 2012

README.rdoc

sequel-cacheable

This plug-in caching mechanism to implement the Model of the Sequel

Usage

Gemfile write:

gem "sequel"
gem "sequel-cacheable"
gem "redis"

Source code write:

Sequel::Model.plugin :cacheable, Redis.new(host: 'localhost', port: 6379)

Caching!

Options

Sequel::Model.plugin :cacheable, cache_client, options_hash

tested cache_client:

options:

{
  :ttl => 3600, # time to live. default 3600
  :pack_lib => MessagePack, # cache packing library. This Object should be have pack / unpack method.
  :query_cache => false # enable query cache. default false
}

Cache Timing

  • select

    • Model.find(id) => Model Cache

    • Model.where(cond).all => Query Cache

  • insert / update

    • clear model cache

    • clear all query caches of model

    • store a new record model cache

  • delete / destroy

    • clear model cache

    • clear all query caches of model

Contributing to sequel-cacheable

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2012 Sho Kusano <rosylilly>. See LICENSE.txt for further details.