mirror of
https://github.com/PaiGramTeam/EnkaNetwork.py.git
synced 2024-11-16 03:45:28 +00:00
15 lines
290 B
Python
15 lines
290 B
Python
import json
|
|
|
|
from cachetools import TTLCache
|
|
|
|
|
|
class Cache:
|
|
def __init__(self, maxsize, ttl):
|
|
self.cache = TTLCache(maxsize, ttl)
|
|
|
|
def get(self, key):
|
|
return json.loads(self.cache.get(key))
|
|
|
|
def set(self, key, value):
|
|
self.cache[key] = json.dumps(value)
|