Class: Chimera::RedisObjectProxy::Collection
- Defined in:
- lib/chimera/redis_objects.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#connection, #decode, #destroy, #encode, #initialize, #key
Constructor Details
This class inherits a constructor from Chimera::RedisObjectProxy::Base
Instance Method Details
#sort(opts = {}) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/chimera/redis_objects.rb', line 82 def sort(opts={}) cmd = [self.key] cmd << "BY #{opts[:by_pattern]}" if opts[:by_pattern] if opts[:limit] start, count = opts[:limit] cmd << "LIMIT #{start} #{count}" if start && count end cmd << "GET #{opts[:get_pattern]}" if opts[:get_pattern] cmd << opts[:order] if opts[:order] cmd << "ALPHA" if opts[:alpha] == true cmd << "STORE #{opts[:dest_key]}" if opts[:dest_key] connection.sort(self.key, cmd.join(" ")) end |