Class: Chimera::RedisObjectProxy::Counter

Inherits:
Base
  • Object
show all
Defined in:
lib/chimera/redis_objects.rb

Instance Attribute Summary

Attributes inherited from Base

#extra_opts, #name, #owner

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

#decrObject



328
329
330
# File 'lib/chimera/redis_objects.rb', line 328

def decr
  connection.decr(self.key).to_i
end

#decrby(val) ⇒ Object Also known as: decr_by



332
333
334
# File 'lib/chimera/redis_objects.rb', line 332

def decrby(val)
  connection.decrby(self.key, val.to_i).to_i
end

#incrObject



318
319
320
# File 'lib/chimera/redis_objects.rb', line 318

def incr
  connection.incr(self.key).to_i
end

#incrby(val) ⇒ Object Also known as: incr_by



322
323
324
# File 'lib/chimera/redis_objects.rb', line 322

def incrby(val)
  connection.incrby(self.key,val.to_i).to_i
end

#valObject Also known as: count



336
337
338
# File 'lib/chimera/redis_objects.rb', line 336

def val
  connection.get(self.key).to_i
end