I want to implement counter on App Engine. The obvious way is to use memcache for this purpose. But docs state that memcache is not reliable and I have to implement fall-back method in case counter in memcache has wrong value or missing. I can easily detect that key is missing, but how can I know that counter has wrong value? I am speaking about following situation:
- key = 30
- incr(key), key = 31
- key is flushed by GAE
- incr(key), key = 1
Is there any trick I don't know (checksum for numbers that works with memcache?)? Should I really care about such situation?
Some probably useless details:
- Counter will have values in range 0-10000.
- Counters should be live 1 hour. I store them in datastore every hour.
- I am using Go.
Thanks.