Module: RedisModel::Types::Base
Overview
Internal: Provides methods for Redis commands related to plain key operations and helpers.
Instance Method Summary collapse
-
#connection ⇒ Object
Public: Helper method for global Redis connection.
-
#del ⇒ Object
(also: #clear)
Public: Removes Redis value associated with the key using Redis command DEL.
-
#exists? ⇒ Boolean
Public: Asserts existence of Redis key having the label using Redis command ExiSTS.
Instance Method Details
#connection ⇒ Object
Public: Helper method for global Redis connection.
Returns global Redis connection object.
27 28 29 |
# File 'lib/redis_model/types/base.rb', line 27 def connection RedisModel::Base.connection end |
#del ⇒ Object Also known as: clear
Public: Removes Redis value associated with the key using Redis command DEL.
Returns 1 if key is deleted, 0 otherwise.
18 19 20 |
# File 'lib/redis_model/types/base.rb', line 18 def del connection.del(key_label) end |
#exists? ⇒ Boolean
Public: Asserts existence of Redis key having the label using Redis command ExiSTS.
Returns true if key exists, false otherwise.
10 11 12 |
# File 'lib/redis_model/types/base.rb', line 10 def exists? connection.exists(key_label) end |