Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.
/ ar_cache Public archive

Performe ActiveRecord cache in File System for heavy and repetitive query.

Notifications You must be signed in to change notification settings

redvex/ar_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Performe ActiveRecord cache in File System for heavy and repetitive query.

Licence

Copyright 2009 Redvex. Distributes under the same terms as Ruby

If you use this software, please make a donation

Features

  • Perform any ActiveRecord Query

  • Set time of expire in database configuration

  • Obtain an Hash as u obtain from active record

  • Support for ActiveRecord shortcuts through (cache_find_first, cache_find_last, cache_find_all)

Usage

Installation

gem sources -a gems.github.com gem install redvex-ar_cache

Add in your config/enviroment.rb

config.gem “redvex-ar_cache”, :lib => ‘ar_cache’, :source => ‘gems.github.com

Use ActiveRecord Cache

If you want to perform a standard call using cache u can try

Object.cache_find(id, params)

EX. Object.cache_find(10)

or

Object.cache_find(:all, :conditions => [‘field>?’,5])

If you want to use an active record shortcuts you can:

Object.cache_find_first(params) Object.cache_find_last(params) Object.cache_find_all(params)

EX.

Object.cache_find_first Object.cache_find_last Object.cache_find_all(:conditions => [‘filed>?’, 5])

Cache reset

If you want to reset cache after predetermined amount of time you can specify time in database.yml config file through cache_expire directive:

cache_expire: 30.seconds cache_expire: 2.hours cache_expire: 1.day cache_expire: 1.month

If you want to force the expire the cache manually you can call the method

cache_reset(id, params=nil)

or shortcuts

cache_reset_first(params=nil) cache_reset_last(params=nil) cache_reset_all(params=nil)

About

Performe ActiveRecord cache in File System for heavy and repetitive query.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages