Method: Redis::Counter#reset
- Defined in:
- lib/redis/counter.rb
#reset(to = ) ⇒ Object
Reset the counter to its starting value. Not atomic, so use with care. Normally only useful if you’re discarding all sub-records associated with a parent and starting over (for example, restarting a game and disconnecting all players).
26 27 28 |
# File 'lib/redis/counter.rb', line 26 def reset(to=[:start]) redis.set key, to.to_i end |