Counters
Increment Values
It's time to increment our counter for team1
to ensure they get points when they are doing well:
When we invoke the Redis INCR
command in line 8, it returns the value of the team1
counter after the increment operation has been completed.
Decrement Values
At times, it is necessary to decrement the points for team1
and this is how we accomplish that goal:
This code is strikingly similar to the code for incrementing counters above, and there are no real surprises here.