Class: Sidekiq::SortedSet
- Inherits:
-
Object
- Object
- Sidekiq::SortedSet
- Includes:
- Enumerable
- Defined in:
- lib/sidekiq/api.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #clear ⇒ Object (also: #💣)
-
#initialize(name) ⇒ SortedSet
constructor
A new instance of SortedSet.
- #scan(match, count = 100) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(name) ⇒ SortedSet
Returns a new instance of SortedSet.
543 544 545 546 |
# File 'lib/sidekiq/api.rb', line 543 def initialize(name) @name = name @_size = size end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
541 542 543 |
# File 'lib/sidekiq/api.rb', line 541 def name @name end |
Instance Method Details
#clear ⇒ Object Also known as: 💣
563 564 565 566 567 |
# File 'lib/sidekiq/api.rb', line 563 def clear Sidekiq.redis do |conn| conn.del(name) end end |
#scan(match, count = 100) ⇒ Object
552 553 554 555 556 557 558 559 560 561 |
# File 'lib/sidekiq/api.rb', line 552 def scan(match, count = 100) return to_enum(:scan, match, count) unless block_given? match = "*#{match}*" unless match.include?("*") Sidekiq.redis do |conn| conn.zscan_each(name, match: match, count: count) do |entry, score| yield SortedEntry.new(self, score, entry) end end end |