Class: ShareDataWatcher::Type::Fetch

Inherits:
Base
  • Object
show all
Defined in:
lib/share-data-watcher/type/fetch.rb

Overview

Fetch Type For cache share watch

Instance Attribute Summary collapse

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods inherited from Base

#restart, #shutdown, #to_h, #valid?

Methods included from Loggable

#debug, #error, #info, #warn

Constructor Details

#initialize(endpoints, key, opt = {}) ⇒ Fetch



13
14
15
16
# File 'lib/share-data-watcher/type/fetch.rb', line 13

def initialize(endpoints, key, opt = {})
  @timeout = opt[:timeout]
  super
end

Instance Attribute Details

#timeoutObject (readonly)

Returns the value of attribute timeout.



8
9
10
# File 'lib/share-data-watcher/type/fetch.rb', line 8

def timeout
  @timeout
end

Instance Method Details

#get(**params) ⇒ Object



18
19
20
21
# File 'lib/share-data-watcher/type/fetch.rb', line 18

def get(**params)
  key = fetch_key(params)
  values[key.to_sym] || fetch(key)
end