threadstore.py 253 B

12345678910111213141516
  1. from threading import local
  2. _thread_local = local()
  3. def get(key, default=None):
  4. return _thread_local.__dict__.get(key, default)
  5. def set(key, value):
  6. return _thread_local.__dict__[key] = value
  7. def clear():
  8. _thread_local.__dict__ = {}