diff --git a/pylast/__init__.py b/pylast/__init__.py index 0316119..72d41b9 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1070,6 +1070,10 @@ class _ShelfCacheBackend(object): """Used as a backend for caching cacheable requests.""" def __init__(self, file_path=None): self.shelf = shelve.open(file_path) + self.cache_keys = set(self.shelf.keys()) + + def __contains__(self, key): + return key in self.cache_keys def __iter__(self): return iter(self.shelf.keys()) @@ -1078,6 +1082,7 @@ class _ShelfCacheBackend(object): return self.shelf[key] def set_xml(self, key, xml_string): + self.cache_keys.add(key) self.shelf[key] = xml_string