CachedResource is a Ruby gem whose goal is to increase the performance of interacting with web services via ActiveResource by caching responses based on request parameters. It can help reduce the lag created by making repeated requests across a network.
CachedResource supports the following Ruby versions:
1.9.2, 1.9.3
2.0.0, 2.1.0
If you require 1.8.7 support, please use version 2.3.4.
CachedResource is designed to be framework agnostic, but will hook into Rails for caching and logging if available. CachedResource officially supports the following Rails versions:
3.2.x
4.0.0
4.1.x
CachedResource accepts the following options:
- :enabled Default: true
- :ttl The time in seconds until the cache should expire. Default: 604800
- :ttl_randomization Enable ttl randomization. Default: false
- :ttl_randomization_scale A Range from which a random value will be selected
- to scale the ttl. Default: 1..2
- :collection_synchronize Use collections to generate cache entries for
individuals. Update the existing cached principal collection when
retrieving subsets of the principal collection or individuals. Default: false - :collection_arguments The arguments that identify the principal collection request. Default: [:all]
- :logger The logger to which CachedResource messages should be written. Default: The Rails.logger if available, or an ActiveSupport::BufferedLogger
- :cache The cache store that CacheResource should use. Default: The Rails.cache if available, or an ActiveSupport::Cache::MemoryStore