Class: Resourceful::AbstractCacheManager

Inherits:
Object
  • Object
show all
Defined in:
lib/resourceful/cache_manager.rb

Instance Method Summary collapse

Constructor Details

#initializeAbstractCacheManager

Returns a new instance of AbstractCacheManager.

Raises:

  • (NotImplementedError)


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.

Parameters:

  • uri (String)

    The uri of the resource to be invalidated



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.

Parameters:

Returns:



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, …)

Parameters:

  • request (Resourceful::Request)

    The request used to obtain the response. This is needed so the values from the response’s Vary header can be stored.

  • response (Resourceful::Response)

    The response to be stored.



32
# File 'lib/resourceful/cache_manager.rb', line 32

def store(request, response); end