You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A what you want point recovery system inside a TTL storage
Requirements
virtualenv
a Redis server up and running on your machine, default port (6379).
Test it
$ git clone https://gist.github.com/4987023.git
$ cd 4987023
$ virtualenv env
$ . env/bin/activate
$ pip install redis
$ ./env/bin/python player.py
Player bob just created
Player bob (stamina=100)
Let's decrease its stamina
Player bob (stamina=90)
And wait for 1 second
have a look to the stamina
Player bob (stamina=91)
and again, wait for 2 seconds
And now the stamina is
Player bob (stamina=93)
A stamina recovery mecanism inside redis TTL... fun :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters