Module: ZkCache

Defined in:
lib/zk_client/zk_cache.rb

Class Method Summary collapse

Class Method Details

.allObject



34
35
36
# File 'lib/zk_client/zk_cache.rb', line 34

def all
  _cache
end

.cache(key, value) ⇒ Object



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

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

.destroy_cacheObject



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

def destroy_cache
  @@cache = {}
end

.load_cacheObject



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

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

.read(key) ⇒ Object



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

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

.root_pathObject



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

def root_path
  ZkClient.root_path
end

.to_sObject



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

def to_s
  _cache.to_json
end