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.
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!
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!
This site uses cookies to give you the best possible experience.
By using the site, you consent to our use of cookies.
For more information, please see our
Privacy Policy