Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 828 Bytes

README.rdoc

File metadata and controls

37 lines (23 loc) · 828 Bytes

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