Is threading.local() a safe way to store variables for a single request in Google AppEngine?

本秂侑毒 提交于 2019-11-30 09:07:42

Yes, using threading.local is an excellent method to set a per-request global. Your request will always be handled by one thread, on one instance in the Google cloud. That thread local value will be unique to that thread.

Take into account that the thread can be reused for future requests, and always reset the value at the start of the request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!