Class: SidekiqUniqueJobs::Redis::String
- Defined in:
- lib/sidekiq_unique_jobs/redis/string.rb
Overview
Class String provides convenient access to redis strings
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#count ⇒ 1, 0
Used only for compatibility with other keys.
-
#del ⇒ Object
Removes the key from redis.
-
#set(obj, pipeline = nil) ⇒ true, false
Sets the value of the key to given object.
-
#value ⇒ String
Returns the value of the key.
Methods inherited from Entity
#exist?, #expires?, #initialize, #pttl, #ttl
Methods included from Timing
clock_stamp, now_f, time_source, timed
Methods included from JSON
dump_json, load_json, safe_load_json
Methods included from Script::Caller
call_script, debug_lua, do_call, extract_args, max_history, normalize_argv, now_f, redis_version
Methods included from Logging
#build_message, included, #log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context, #with_configured_loggers_context, #with_logging_context
Constructor Details
This class inherits a constructor from SidekiqUniqueJobs::Redis::Entity
Instance Method Details
#count ⇒ 1, 0
Used only for compatibility with other keys
46 47 48 |
# File 'lib/sidekiq_unique_jobs/redis/string.rb', line 46 def count exist? ? 1 : 0 end |
#del ⇒ Object
Removes the key from redis
37 38 39 |
# File 'lib/sidekiq_unique_jobs/redis/string.rb', line 37 def del(*) redis { |conn| conn.del(key) } end |
#set(obj, pipeline = nil) ⇒ true, false
Sets the value of the key to given object
28 29 30 31 32 |
# File 'lib/sidekiq_unique_jobs/redis/string.rb', line 28 def set(obj, pipeline = nil) return pipeline.set(key, obj) if pipeline redis { |conn| conn.set(key, obj) } end |
#value ⇒ String
Returns the value of the key
17 18 19 |
# File 'lib/sidekiq_unique_jobs/redis/string.rb', line 17 def value redis { |conn| conn.get(key) } end |