关于Google App Engine:在python 2.5-> 2.7迁移中使用内存缓存

Using memcache in python 2.5 -> 2.7 migration

我正在将GAE应用程序从python 2.5迁移到2.7。 迁移文档说:

Warning: If your app uses memcache, be aware that datastore entities cached by Python 2.7 apps will raise an error if fetched from an app on the Python 2.5 runtime. It is strongly recommended that you do not simultaneously use both Python runtimes on the same app ID, even as different app versions. If you must use both runtimes, be careful not to store datastore entities in memcache. If you must, and are using NDB, temporarily disable automatic caching by adding _use_memcache=False to your models until your app is completely migrated to 2.7.

如果我使用2.5部署一个版本,而使用2.7部署另一个版本,并且它们都使用内存缓存,并且确保它们使用的内存缓存键是互斥的,那么可以避免此问题吗?

我意识到最安全的做法是在我的2.7版本中禁用memcache,直到我可以退出我的2.5版本为止,但这将使2.7版本的测试更加困难,因此,如果可能的话,我宁愿同时使用这两个版本。


我相信,如果您绝对肯定已经隔离了两个不同版本所使用的密钥,那么您会没事的。

为了安全起见,建议您使用流量分割功能将少量流量发送到您的Python 2.7版本,这样,如果出现问题,它们就会在您的流量中显示一小部分。 您可以逐渐增加百分比,同时注意错误,直到从新版本提供所有流量为止。