Sha256: dbdf1953217cab8814be7306e09f9cdb9163a5db9c6c545b3139bea11f72484f

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# CachedResource 
CachedResource helps ActiveResource by caching responses according to request parameters.  It can help reduce the lag created by making repeated requests across the network.  

## Installation
	gem install cached_resource

## Configuration
CachedResource works "out of the box" with ActiveResource.  By default, it caches responses to an `ActiveSupport::Cache::MemoryStore` and logs to an `ActiveSupport::BufferedLogger` attached to a `StringIO` object.  **In a Rails 3 environment**, CachedResource will attach itself to the Rails logger and cache.

Turn CachedResource off.  This will cause all ActiveResource responses to be retrieved normally (i.e. via the network). 

	CachedResource.off!
	
Turn CachedResource on.

	CachedResource.on!
	
Set the cache expiry time to 60 seconds.

	CachedResource.config.cache_time_to_live = 60
	
Set a different logger.

	CachedResource.config.logger = MyLogger.new
	
Set a different cache store.

	CachedResource.config.cache = MyCacheStore.new

## Usage
Sit back and relax! If you need to reload a particular request you can do something like:

	MyActiveResource.find(:all, :reload => true)

## Testing
	rake

## Credit/Inspiration
quamen and [this gist](http://gist.github.com/947734)
latimes and [this plugin](http://github.com/latimes/cached_resource)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cached_resource-1.0.1 README.md