class Faulty::Cache::Interface
The interface required for a cache backend implementation
This is for documentation only and is not loaded
Public Instance Methods
Can this cache backend raise an error?
If the cache backend returns false from this method, it will be wrapped in a {FaultTolerantProxy}, otherwise it will be used as-is.
@return [Boolean] True if this cache backend is fault tolerant
# File lib/faulty/cache/interface.rb, line 39 def fault_tolerant? raise NotImplementedError end
Retrieve a value from the cache if available
@param key [String] The cache key @raise If the cache backend encounters a failure @return [Object, nil] The object if present, otherwise nil
# File lib/faulty/cache/interface.rb, line 14 def read(key) raise NotImplementedError end
Write a value to the cache
This may be any object. It's up to the cache implementation to serialize if necessary or raise an error if unsupported.
@param key [String] The cache key @param expires_in [Integer, nil] The number of seconds until this cache
entry expires. If nil, no expiration is set.
@param value [Object] The value to write to the cache @raise If the cache backend encounters a failure @return [void]
# File lib/faulty/cache/interface.rb, line 29 def write(key, value, expires_in: nil) raise NotImplementedError end