* morituri/common/cache.py:

Disable the version-based persistence deleting.
	  Allow not creating a fresh ripresult when getting one.
This commit is contained in:
Thomas Vander Stichele
2012-12-02 17:53:47 +00:00
parent 306e6f2ad7
commit 67540627fa
2 changed files with 16 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/cache.py:
Disable the version-based persistence deleting.
Allow not creating a fresh ripresult when getting one.
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/cache.py:

View File

@@ -137,8 +137,8 @@ class PersistedCache(object):
if persister.object:
if hasattr(persister.object, 'instanceVersion'):
o = persister.object
if o.instanceVersion < o.__class__.classVersion:
persister.delete()
# if o.instanceVersion < o.__class__.classVersion:
# persister.delete()
return persister
@@ -157,7 +157,7 @@ class ResultCache(log.Loggable):
'result')
return path
def getRipResult(self, cddbdiscid):
def getRipResult(self, cddbdiscid, create=True):
"""
Retrieve the persistable RipResult either from our cache (from a
previous, possibly aborted rip), or return a new one.
@@ -167,10 +167,14 @@ class ResultCache(log.Loggable):
presult = self._pcache.get(cddbdiscid)
if not presult.object:
self.debug('result for cddbdiscid %r not in cache, creating',
cddbdiscid)
self.debug('result for cddbdiscid %r not in cache', cddbdiscid)
if not create:
self.debug('returning None')
return None
self.debug('creating result')
presult.object = result.RipResult()
presult.persist(self.result)
presult.persist(presult.object)
else:
self.debug('result for cddbdiscid %r found in cache, reusing',
cddbdiscid)