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 ⇒ 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.
87 88 89 90 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 87 def initialize(cass, cf) @cass = cass @cf = cf end |
Instance Method Details
#clear ⇒ Object
108 109 110 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 108 def clear @cass.del @cf, "globals" end |
#get(key) ⇒ Object
92 93 94 95 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 92 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
104 105 106 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 104 def global_keys @cass.get(@cf, "globals").keys end |
#set(key, value) ⇒ Object
Set a global value
98 99 100 101 |
# File 'lib/dcell/registries/cassandra_adapter.rb', line 98 def set(key, value) string = Marshal.dump value @cass.insert @cf, "globals", { key.to_s => string } end |