Class: Faulty::Cache::Interface
- Inherits:
-
Object
- Object
- Faulty::Cache::Interface
- Defined in:
- lib/faulty/cache/interface.rb
Overview
The interface required for a cache backend implementation
This is for documentation only and is not loaded
Instance Method Summary collapse
-
#fault_tolerant? ⇒ Boolean
Can this cache backend raise an error?.
-
#read(key) ⇒ Object?
Retrieve a value from the cache if available.
-
#write(key, value, expires_in: nil) ⇒ void
Write a value to the cache.
Instance Method Details
#fault_tolerant? ⇒ Boolean
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.
39 40 41 |
# File 'lib/faulty/cache/interface.rb', line 39 def fault_tolerant? raise NotImplementedError end |
#read(key) ⇒ Object?
Retrieve a value from the cache if available
14 15 16 |
# File 'lib/faulty/cache/interface.rb', line 14 def read(key) raise NotImplementedError end |
#write(key, value, expires_in: nil) ⇒ void
This method returns an undefined value.
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.
29 30 31 |
# File 'lib/faulty/cache/interface.rb', line 29 def write(key, value, expires_in: nil) raise NotImplementedError end |