Module: ZkCache

Defined in:
lib/zk_client/zk_cache.rb

Class Method Summary collapse

Class Method Details

.cache(key, value) ⇒ Object



7
8
9
# File 'lib/zk_client/zk_cache.rb', line 7

def cache(key, value)
  _cache[key] = value
end

.destroy_cacheObject



21
22
23
# File 'lib/zk_client/zk_cache.rb', line 21

def destroy_cache
  @@cache = {}
end

.load_cacheObject



16
17
18
19
# File 'lib/zk_client/zk_cache.rb', line 16

def load_cache
  _load_cache(ZkClient.root_path)
  self.to_s
end

.read(key) ⇒ Object



11
12
13
14
# File 'lib/zk_client/zk_cache.rb', line 11

def read(key)
  path = _process_path(key)
  _cache[path]
end

.root_pathObject



29
30
31
# File 'lib/zk_client/zk_cache.rb', line 29

def root_path
  ZkClient.root_path
end

.to_sObject



25
26
27
# File 'lib/zk_client/zk_cache.rb', line 25

def to_s
  _cache.to_json
end