Skip to content

Store the version of any class for cache invalidation

License

Notifications You must be signed in to change notification settings

geni/cache_version

 
 

Repository files navigation

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

About

Store the version of any class for cache invalidation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%