Class: SaferRedis::Suggestion

Inherits:
Object
  • Object
show all
Defined in:
lib/safer_redis/suggestion.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, description) ⇒ Suggestion

Returns a new instance of Suggestion.



7
8
9
10
# File 'lib/safer_redis/suggestion.rb', line 7

def initialize(command, description)
  @command = command
  @description = description
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



5
6
7
# File 'lib/safer_redis/suggestion.rb', line 5

def command
  @command
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/safer_redis/suggestion.rb', line 5

def description
  @description
end

Class Method Details

.for_command(command) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/safer_redis/suggestion.rb', line 12

def self.for_command(command)
  case command
  when "DEL"
    new(command, <<~END)
      Consider using the non-blocking UNLINK command instead to delete the key on a \
      background thread, or set the lazyfree-lazy-user-del server option
    END
  else
    nil
  end
end