0

Google is extremely vague about when memcache entries might expire in the shared memcache. This is completely understandable as it is free and shared but does anybody have any practical guidance for how long my entries will probably exist before they are removed from the shared cache? 1 hour? 1 day? 1 week? 1 month?

I plan to store some session tokens and am trying to figure out how long the sessions can be revisited.

Arlo Gilbert
  • 131
  • 1
  • 4
  • You may find additional answers here: http://stackoverflow.com/questions/2649747/how-often-does-memcache-on-google-appengine-lose-data/39140823#39140823 – cat Aug 25 '16 at 09:05

2 Answers2

1

The memcache can trashed all your datas at any time. You can't really trust the expiration time.

According to Google, your application must work fine even without or with memcache. The memcache is just a plus to avoid to make a lot of datastore queries and manage correctly your quotas.

And for you, the memcache is not the place to store sessions tokens. If you are using Python, you can user webapp2 sessions. It works wonderful with AppEngine.

Maël
  • 259
  • 1
  • 11
  • Thanks for replying but this does not answer the question. I am aware of the Google party line about memcache availability but am looking for real world experiences about how long items actually remain in GAE memcache. – Arlo Gilbert Sep 03 '14 at 15:49
  • I answered to your last sentence. Sometimes items expires after 1 hour and sometimes after 1 day. – Maël Sep 03 '14 at 19:47
0

I've honestly seen memcache last for a day, and as little as an hour.... And I never actively monitored memcache, so I wouldn't be surprised if you have way bigger or smaller timeframes in your memcache.

It's really hard to say, since (I guess) it depends on internal usage of the computer used for your instance and how much resources are needed by other computers around.

Unfortunately there is no real answer yo this question besides : code defensively, always check memcache and then if you don't find your data in memcache, you grab it from your permanent data (datastore I guess? or cloud storage) and then push it back to memcache for your next use

Patrice
  • 4,641
  • 9
  • 33
  • 43