Class: Ohm::Key
Overview
Represents a key in Redis. Much of the heavylifting is done using the Nest library.
The most important change added by Key to Nest is the concept of volatile keys, which are used heavily when doing Model::Set#find or Model::Set#except operations.
A volatile key is simply a key prefixed with `~`. This gives you the benefit if quickly seeing which keys are temporary keys by doing something like:
$ redis-cli keys "~*"
Instance Method Summary (collapse)
-
- (Object) +(other)
Produces a key with `other` suffixed with itself.
-
- (Object) -(other)
Produces a key with `other` suffixed with itself.
- - (Object) volatile
Instance Method Details
- (Object) +(other)
Produces a key with `other` suffixed with itself. This is primarily used for storing SINTERSTORE results.
24 25 26 |
# File 'lib/ohm/key.rb', line 24 def +(other) self.class.new("#{self}+#{other}", redis) end |
- (Object) -(other)
Produces a key with `other` suffixed with itself. This is primarily used for storing SDIFFSTORE results.
30 31 32 |
# File 'lib/ohm/key.rb', line 30 def -(other) self.class.new("#{self}-#{other}", redis) end |
- (Object) volatile
18 19 20 |
# File 'lib/ohm/key.rb', line 18 def volatile self.index("~") == 0 ? self : self.class.new("~", redis)[self] end |