Class: Resourceful::AbstractCacheManager
- Defined in:
- lib/resourceful/cache_manager.rb
Direct Known Subclasses
FileCacheManager, InMemoryCacheManager, MemcacheCacheManager, NullCacheManager
Instance Method Summary collapse
-
#initialize ⇒ AbstractCacheManager
constructor
A new instance of AbstractCacheManager.
-
#invalidate(uri) ⇒ Object
Invalidates a all cached entries for a uri.
-
#lookup(request) ⇒ Resourceful::Response
Finds a previously cached response to the provided request.
-
#store(request, response) ⇒ Object
Store a response in the cache.
Constructor Details
#initialize ⇒ AbstractCacheManager
Returns a new instance of AbstractCacheManager.
7 8 9 10 |
# File 'lib/resourceful/cache_manager.rb', line 7 def initialize raise NotImplementedError, "Use one of CacheManager's child classes instead. Try NullCacheManager if you don't want any caching at all." end |
Instance Method Details
#invalidate(uri) ⇒ Object
Invalidates a all cached entries for a uri.
This is used, for example, to invalidate the cache for a resource that gets POSTed to.
41 |
# File 'lib/resourceful/cache_manager.rb', line 41 def invalidate(uri); end |
#lookup(request) ⇒ Resourceful::Response
Finds a previously cached response to the provided request. The response returned may be stale.
20 |
# File 'lib/resourceful/cache_manager.rb', line 20 def lookup(request); end |
#store(request, response) ⇒ Object
Store a response in the cache.
This method is smart enough to not store responses that cannot be cached (Vary: * or Cache-Control: no-cache, private, …)
32 |
# File 'lib/resourceful/cache_manager.rb', line 32 def store(request, response); end |