Module: ZkCache
- Defined in:
- lib/zk_client/zk_cache.rb
Class Method Summary collapse
- .cache(key, value) ⇒ Object
- .destroy_cache ⇒ Object
- .load_cache ⇒ Object
- .read(key) ⇒ Object
- .root_path ⇒ Object
- .to_s ⇒ Object
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_cache ⇒ Object
21 22 23 |
# File 'lib/zk_client/zk_cache.rb', line 21 def destroy_cache @@cache = {} end |
.load_cache ⇒ Object
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_path ⇒ Object
29 30 31 |
# File 'lib/zk_client/zk_cache.rb', line 29 def root_path ZkClient.root_path end |
.to_s ⇒ Object
25 26 27 |
# File 'lib/zk_client/zk_cache.rb', line 25 def to_s _cache.to_json end |