Class: Vidocq::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/vidocq/cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(sid, version, opts = {}) ⇒ Cache

Returns a new instance of Cache.



6
7
8
9
10
11
# File 'lib/vidocq/cache.rb', line 6

def initialize(sid, version, opts = {})
  @ttl = opts.fetch(:ttl, 0)
  @cs = opts.fetch(:zk, 'localhost:2181')
  @parent = "/companybook/services/#{sid}/#{version}"
  @endpoints = []
end

Instance Method Details

#endpointsObject



13
14
15
# File 'lib/vidocq/cache.rb', line 13

def endpoints
  outdated? ? expire! : @endpoints
end