Class: Riddick::Backends::Redis
- Defined in:
- lib/riddick/backends/redis.rb,
lib/riddick/backends/redis/value.rb
Overview
Redis based key-value backend.
Defined Under Namespace
Classes: Value
Instance Attribute Summary
Attributes inherited from KeyValue
Instance Method Summary collapse
-
#delete_translation(k) ⇒ Object
Delete a translation from the store.
-
#translations ⇒ Object
Fetch and return custom translation as a hash of type: => ‘baz’.
Methods inherited from KeyValue
Constructor Details
This class inherits a constructor from Riddick::Backends::KeyValue
Instance Method Details
#delete_translation(k) ⇒ Object
Delete a translation from the store.
6 7 8 |
# File 'lib/riddick/backends/redis.rb', line 6 def delete_translation(k) store.del k end |
#translations ⇒ Object
Fetch and return custom translation as a hash of type: => ‘baz’. Values of the hash are of kind Riddick::Backends::Redis::Value, so it’s easy to determine whether they are custom translation or the predefined.
13 14 15 16 17 18 19 20 |
# File 'lib/riddick/backends/redis.rb', line 13 def translations keys = store.keys if keys.any? Hash[keys.zip store.mget(keys).map { |v| Riddick::Backends::Redis::Value.new v }] else {} end end |