Class: Cachext::Client
- Inherits:
-
Object
- Object
- Cachext::Client
- Includes:
- Features::Backup, Features::CircuitBreaker, Features::DebugLogging, Features::Default, Features::Lock
- Defined in:
- lib/cachext/client.rb
Constant Summary
Constants included from Features::Lock
Features::Lock::TimeoutWaitingForLock
Instance Attribute Summary
Attributes included from Features::CircuitBreaker
Instance Method Summary collapse
- #fetch(key, options_hash = {}, &block) ⇒ Object
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
Methods included from Features::Lock
#obtain_lock, #wait_for_lock, #with_heartbeat_extender
Constructor Details
#initialize(config) ⇒ Client
11 12 13 |
# File 'lib/cachext/client.rb', line 11 def initialize config @config = config end |
Instance Method Details
#fetch(key, options_hash = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cachext/client.rb', line 15 def fetch key, = {}, &block = Options.new @config, retval = read key, return retval unless retval.nil? call_block key, , &block rescue *Array(.not_found_error) => e handle_not_found key, , e rescue Features::Lock::TimeoutWaitingForLock, *.errors => e handle_error key, , e end |