Store "as it" in JSON (int or str)

The json lib does all the work
master
pictuga 2013-12-01 15:46:02 +01:00
parent 52fe67beb3
commit 66c6dcf203
1 changed files with 4 additions and 4 deletions

View File

@ -151,17 +151,17 @@ class Cache:
def __contains__(self, key):
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:
return kind(self._cache[key])
return self._cache[key]
elif key in self._cached:
self._cache[key] = self._cached[key]
return kind(self._cached[key])
return self._cached[key]
else:
return None
def set(self, key, content):
self._cache[key] = str(content) or ''
self._cache[key] = content
def save(self):
if len(self._cache) == 0: