Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Store the version of any class for cache invalidation
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
.rbenv-gemsets
.rbenv-version
Gemfile
LICENSE
README.rdoc
Rakefile
VERSION
cache_version.gemspec

README.rdoc

CacheVersion

CacheVersion lets you maintain a version for any class. This can be used for cache invalidation, and RecordCache and MethodCache use it for that. It uses memcache to reduce database access when the version of a class hasn't changed.

Usage:

CacheVersion.get(User)
# => 0

CacheVersion.increment(User)
CacheVersion.get(User)
# => 1

# Or you can use the alternate syntax:

User.version
# => 1

User.increment_version
User.version
# => 2

Install:

sudo gem install cache-version -s http://gemcutter.org

Also, you need to create a migration to make the cache_versions table. See examples/sample_migration.rb

Dependencies:

License:

Copyright © 2009 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE

Something went wrong with that request. Please try again.