Class: DCell::Registry::CassandraAdapter::GlobalRegistry
- Inherits:
-
Object
- Object
- DCell::Registry::CassandraAdapter::GlobalRegistry
- Defined in:
- lib/dcell/registries/cassandra_adapter.rb
Instance Method Summary collapse
- #clear_all ⇒ Object
- #get(key) ⇒ Object
-
#global_keys ⇒ Object
The keys to all globals in the system.
-
#initialize(cass, cf) ⇒ GlobalRegistry
constructor
A new instance of GlobalRegistry.
-
#set(key, value) ⇒ Object
Set a global value.
Constructor Details
#initialize(cass, cf) ⇒ GlobalRegistry
Returns a new instance of GlobalRegistry.
95 96 97 98 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 95 def initialize(cass, cf) @cass = cass @cf = cf end |
Instance Method Details
#clear_all ⇒ Object
116 117 118 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 116 def clear_all @cass.del @cf, "globals" end |
#get(key) ⇒ Object
100 101 102 103 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 100 def get(key) string = @cass.get @cf, "globals", key.to_s Marshal.load string if string end |
#global_keys ⇒ Object
The keys to all globals in the system
112 113 114 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 112 def global_keys @cass.get(@cf, "globals").keys end |
#set(key, value) ⇒ Object
Set a global value
106 107 108 109 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 106 def set(key, value) string = Marshal.dump value @cass.insert @cf, "globals", { key.to_s => string } end |