parent
52fe67beb3
commit
66c6dcf203
8
morss.py
8
morss.py
|
@ -151,17 +151,17 @@ class Cache:
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
return key in self._cache or key in self._cached
|
return key in self._cache or key in self._cached
|
||||||
|
|
||||||
def get(self, key, kind=str):
|
def get(self, key):
|
||||||
if key in self._cache:
|
if key in self._cache:
|
||||||
return kind(self._cache[key])
|
return self._cache[key]
|
||||||
elif key in self._cached:
|
elif key in self._cached:
|
||||||
self._cache[key] = self._cached[key]
|
self._cache[key] = self._cached[key]
|
||||||
return kind(self._cached[key])
|
return self._cached[key]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set(self, key, content):
|
def set(self, key, content):
|
||||||
self._cache[key] = str(content) or ''
|
self._cache[key] = content
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
if len(self._cache) == 0:
|
if len(self._cache) == 0:
|
||||||
|
|
Loading…
Reference in New Issue