代码拉取完成,页面将自动刷新
class Cache:
def __init__(self):
self.user_cache: dict[str, dict[str, any]] = {}
self.product_cache: dict[str, dict[str, any]] = {}
def get_user_cache(self, user_id: str) -> dict[str, any]:
return self.user_cache.get(user_id, {})
def set_user_cache(self, user_id: str, value: dict[str, any]):
self.user_cache[user_id] = value
def delete_user_cache(self, user_id: str):
del self.user_cache[user_id]
def clear_user_cache(self):
self.user_cache.clear()
def get_product_cache(self, product_id: str) -> dict[str, any]:
return self.product_cache.get(product_id, {})
def set_product_cache(self, product_id: str, value: dict[str, any]):
self.product_cache[product_id] = value
def delete_product_cache(self, product_id: str):
del self.product_cache[product_id]
def clear_product_cache(self):
self.product_cache.clear()
def clear_all_cache(self):
self.user_cache.clear()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。