mirror of
https://github.com/PaiGramTeam/EnkaNetwork.py.git
synced 2024-11-16 03:45:28 +00:00
13 lines
296 B
Python
13 lines
296 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)
|