Class: RedisClient::Namespace Deprecated
- Inherits:
-
Object
- Object
- RedisClient::Namespace
- Defined in:
- lib/redis_client/namespace.rb,
lib/redis_client/namespace/version.rb,
lib/redis_client/namespace/middleware.rb,
lib/redis_client/namespace/command_builder.rb
Overview
Use Middleware instead
RedisClient::Namespace provides transparent key namespacing for redis-client.
DEPRECATED: Using this class as a command_builder is deprecated. Please use RedisClient::Namespace::Middleware instead for full namespace support including automatic removal of namespace prefixes from command results.
The command_builder approach only transforms outgoing commands but cannot process incoming results to remove namespace prefixes from keys returned by commands like KEYS, SCAN, BLPOP, etc.
Defined Under Namespace
Modules: CommandBuilder, Middleware Classes: Error
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#parent_command_builder ⇒ Object
readonly
Returns the value of attribute parent_command_builder.
-
#separator ⇒ Object
readonly
Returns the value of attribute separator.
Instance Method Summary collapse
- #generate(args, kwargs = nil) ⇒ Object
-
#initialize(namespace = "", separator: ":", parent_command_builder: RedisClient::CommandBuilder) ⇒ Namespace
constructor
A new instance of Namespace.
Constructor Details
#initialize(namespace = "", separator: ":", parent_command_builder: RedisClient::CommandBuilder) ⇒ Namespace
Returns a new instance of Namespace.
38 39 40 41 42 |
# File 'lib/redis_client/namespace.rb', line 38 def initialize(namespace = "", separator: ":", parent_command_builder: RedisClient::CommandBuilder) @namespace = namespace @separator = separator @parent_command_builder = parent_command_builder end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
36 37 38 |
# File 'lib/redis_client/namespace.rb', line 36 def namespace @namespace end |
#parent_command_builder ⇒ Object (readonly)
Returns the value of attribute parent_command_builder.
36 37 38 |
# File 'lib/redis_client/namespace.rb', line 36 def parent_command_builder @parent_command_builder end |
#separator ⇒ Object (readonly)
Returns the value of attribute separator.
36 37 38 |
# File 'lib/redis_client/namespace.rb', line 36 def separator @separator end |
Instance Method Details
#generate(args, kwargs = nil) ⇒ Object
44 45 46 47 |
# File 'lib/redis_client/namespace.rb', line 44 def generate(args, kwargs = nil) CommandBuilder.namespaced_command(@parent_command_builder.generate(args, kwargs), namespace: @namespace, separator: @separator) end |