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.
547 548 549 550 |
# File 'lib/sidekiq/api.rb', line 547 def initialize(name) @name = name @_size = size end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
545 546 547 |
# File 'lib/sidekiq/api.rb', line 545 def name @name end |
Instance Method Details
#clear ⇒ Object Also known as: 💣
567 568 569 570 571 |
# File 'lib/sidekiq/api.rb', line 567 def clear Sidekiq.redis do |conn| conn.del(name) end end |
#scan(match, count = 100) ⇒ Object
556 557 558 559 560 561 562 563 564 565 |
# File 'lib/sidekiq/api.rb', line 556 def scan(match, count = 100) return to_enum(:scan, match) 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 |