Class: RedisClient::Cluster::NormalizedCmdName
- Inherits:
-
Object
- Object
- RedisClient::Cluster::NormalizedCmdName
- Includes:
- Singleton
- Defined in:
- lib/redis_client/cluster/normalized_cmd_name.rb
Constant Summary collapse
- EMPTY_STRING =
''
Instance Method Summary collapse
- #clear ⇒ Object
- #get_by_command(command) ⇒ Object
- #get_by_name(name) ⇒ Object
- #get_by_subcommand(command) ⇒ Object
-
#initialize ⇒ NormalizedCmdName
constructor
A new instance of NormalizedCmdName.
Constructor Details
#initialize ⇒ NormalizedCmdName
Returns a new instance of NormalizedCmdName.
12 13 14 15 |
# File 'lib/redis_client/cluster/normalized_cmd_name.rb', line 12 def initialize @cache = {} @mutex = Mutex.new end |
Instance Method Details
#clear ⇒ Object
29 30 31 32 |
# File 'lib/redis_client/cluster/normalized_cmd_name.rb', line 29 def clear @mutex.synchronize { @cache.clear } true end |
#get_by_command(command) ⇒ Object
17 18 19 |
# File 'lib/redis_client/cluster/normalized_cmd_name.rb', line 17 def get_by_command(command) get(command, index: 0) end |
#get_by_name(name) ⇒ Object
25 26 27 |
# File 'lib/redis_client/cluster/normalized_cmd_name.rb', line 25 def get_by_name(name) get(name, index: 0) end |
#get_by_subcommand(command) ⇒ Object
21 22 23 |
# File 'lib/redis_client/cluster/normalized_cmd_name.rb', line 21 def get_by_subcommand(command) get(command, index: 1) end |