Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dustin/has_local_cache
A rails plugin for building in-process caches that invalidate after each request.
https://github.com/dustin/has_local_cache
Last synced: 3 days ago
JSON representation
A rails plugin for building in-process caches that invalidate after each request.
- Host: GitHub
- URL: https://github.com/dustin/has_local_cache
- Owner: dustin
- License: mit
- Created: 2008-10-27T08:20:08.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2008-10-27T20:14:34.000Z (about 16 years ago)
- Last Synced: 2024-11-11T13:06:36.005Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 82 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Has Local Cache
An in-process cache that resets at the end of a request.
Memcached is fast, but an app can get really slow if it's hit too frequently.
Some things should be considered valid throughout a request. This helps with
those things.I may fold this functionality into cache\_fu itself, but this plugin will at
least help me (and you) get some experience with in-process caches first.# Usage
class SomeModel < ActiveRecord::Base
acts_as_cached
has_local_cache
endSomeModel.get_cache('somekey') do
# Some expensive code that will run if the local cache
# and memcached both return nothing.
endCopyright (c) 2008 Dustin Sallings, released under the MIT license