Py学习  »  Python

Thread local 清除缓存

爱情的枪 • 9 年前 • 2686 次点击  
>>> l = threading.local()
>>> l
<thread._local object at 0x7fe8d5af5fb0>
>>> l.ok = "yes"
>>> l.__dict__
{'ok': 'yes'}
>>> l.__dict__.clear()
>>> l.__dict__
{}
>>> l.ok
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'thread._local' object has no attribute 'ok'

http://stackoverflow.com/questions/25693508/how-do-i-clear-a-python-threading-local-object

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/869
 
2686 次点击