kwork-poizonstore/utils/cache.py

14 lines
262 B
Python

import threading
thread_local = threading.local()
class InMemoryCache:
@classmethod
def get(cls, key: str):
return getattr(thread_local, key, None)
@classmethod
def set(cls, key: str, value):
setattr(thread_local, key, value)