threadstore.py 288 B

1234567891011121314151617
  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. _thread_local.__dict__[key] = value
  7. return _thread_local.__dict__[key]
  8. def clear():
  9. _thread_local.__dict__.clear()