0
I Use This!
Activity Not Available

Project Summary

ModelCache to use on an ActiveRecord class to cache method calls. Example:

Class X < ActiveRecord::Base
def heavy_calculation(a, b)
"result #{self.x} #{a} #{b}"
end

include ModelCacheHelper
cache_method :heavy_calculation
endThe created method X.heavy_calculation(id, arg1, arg2) will then check if the result is cached, otherwise it will do X.find(1).heavy_calculation(arg1, arg2) and cache the result. Calling heavy_calculation on an instance of X will also cache the result.

The instance method expire_cache, will expire the cache for that object. It can be used with an optional argument, expire_cache(method), to only expire the cache for a certain method.

Non-string result will be serialized with YAML and automatically deserialized when loaded.

The extra argument kan be used to define extra parameters to the find-request.

cache_method :heavy_calculation, :include => "content_items"

Tags

activerecord rails ruby

In a Nutshell, model-cache...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

BSD 4-clause (University of California-Specific)
Permitted

Commercial Use

Modify

Distribute

Place Warranty

Forbidden

Hold Liable

Use Trademarks

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    65% of companies leverage OSS to speed application development in 2016
  • ...
    anyone with an Open Hub account can update a project's tags
  • ...
    nearly 1 in 3 companies have no process for identifying, tracking, or remediating known open source vulnerabilities
  • ...
    data presented on the Open Hub is available through our API

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
  
Review this Project!