Python 3.7 and Python 2 ndb cache conflict

57 views
Skip to first unread message

Eliran Segev

unread,
Dec 4, 2019, 8:20:46 AM12/4/19
to Google App Engine
Hi, we are migrating our python 2 services to python 3.


In python 2 we are using NDB - that uses Memcache
In python 3 we are using cloud NDB - that cannot have Memcache as cache provider

And now we have a problem when updating an entity from Python 3 it does not affect the cache, and when using Python 2 we get the cached copy of this entity.


Without changing python 2 code to cloud NDB, how can we solve this and still have cache?

Andrew Gorcester

unread,
Dec 4, 2019, 4:57:13 PM12/4/19
to google-a...@googlegroups.com
Hi Eliran,

On Python 3, you can use Cloud Memorystore to provide a Redis cache. However, you can't currently share a cache between the Python 2.7 and Python 3.7 versions of the GAE. The cache will be separate, which will be an issue as you describe if you are running both Python 2 and Python 3 versions targeting the same Datastore database.

Now that Cloud NDB supports Python 2.7 in addition to Python 3.7, you could try to solve this problem by replacing your GAE NDB with Cloud NDB on Python 2.7, and then pointing it at the same Redis instance as the Python 3.7 version. Instead of sharing Memcache, you can share Redis. See the documentation for more info: https://cloud.google.com/appengine/docs/standard/python3/migrating-to-cloud-ndb

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/19ecce3c-e774-491f-a168-40b99393c651%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages