Class: DCell::Registry::MonetaAdapter
- Inherits:
-
Object
- Object
- DCell::Registry::MonetaAdapter
- Defined in:
- lib/dcell/registries/moneta_adapter.rb
Defined Under Namespace
Classes: Registry
Instance Method Summary collapse
- #clear_globals ⇒ Object
- #clear_nodes ⇒ Object
- #get_global(key) ⇒ Object
- #get_node(node_id) ⇒ Object
- #global_keys ⇒ Object
-
#initialize(options) ⇒ MonetaAdapter
constructor
A new instance of MonetaAdapter.
- #nodes ⇒ Object
- #set_global(key, value) ⇒ Object
- #set_node(node_id, addr) ⇒ Object
Constructor Details
#initialize(options) ⇒ MonetaAdapter
Returns a new instance of MonetaAdapter.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 7 def initialize() # Convert all options to symbols :/ = .inject({}) { |h,(k,v)| h[k.to_sym] = v; h } @env = [:env] || 'production' @namespace = [:namespace] || "dcell_#{@env}" # We might want to use something like a TieredCache later.. # Memory + BasicFile.. # @moneta = Moneta::TieredCache.new options @moneta = Moneta::Memory.new @node_registry = Registry.new(@moneta, :nodes) @global_registry = Registry.new(@moneta, :globals) end |
Instance Method Details
#clear_globals ⇒ Object
58 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 58 def clear_globals; @global_registry.clear end |
#clear_nodes ⇒ Object
53 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 53 def clear_nodes; @node_registry.clear end |
#get_global(key) ⇒ Object
55 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 55 def get_global(key); @global_registry.get(key) end |
#get_node(node_id) ⇒ Object
50 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 50 def get_node(node_id); @node_registry.get(node_id) end |
#global_keys ⇒ Object
57 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 57 def global_keys; @global_registry.global_keys end |
#nodes ⇒ Object
52 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 52 def nodes; @node_registry.nodes end |
#set_global(key, value) ⇒ Object
56 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 56 def set_global(key, value); @global_registry.set(key, value) end |
#set_node(node_id, addr) ⇒ Object
51 |
# File 'lib/dcell/registries/moneta_adapter.rb', line 51 def set_node(node_id, addr); @node_registry.set(node_id, addr) end |