More cache work -- remove some code, get rid of old file.

This commit is contained in:
Charles Haley 2013-10-01 19:27:08 +02:00
parent e34d7bdee7
commit e161df6fff

View File

@ -687,10 +687,6 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
key = uuid+ext key = uuid+ext
if isinstance(lastmod, unicode): if isinstance(lastmod, unicode):
lastmod = parse_date(lastmod) lastmod = parse_date(lastmod)
# if key in self.known_uuids:
# self._debug(key, lastmod, self.known_uuids[key].last_modified)
# else:
# self._debug(key, 'not in known uuids')
if key in self.known_uuids and self.known_uuids[key]['book'].last_modified == lastmod: if key in self.known_uuids and self.known_uuids[key]['book'].last_modified == lastmod:
self.known_uuids[key]['last_used'] = now() self.known_uuids[key]['last_used'] = now()
return self.known_uuids[key]['book'].deepcopy() return self.known_uuids[key]['book'].deepcopy()
@ -718,21 +714,14 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
return None return None
def _read_metadata_cache(self): def _read_metadata_cache(self):
# cache_file_name = os.path.join(cache_dir(), try:
# 'device_drivers_' + self.__class__.__name__ + old_cache_file_name = os.path.join(cache_dir(),
# '_metadata_cache.pickle') 'device_drivers_' + self.__class__.__name__ +
# if os.path.exists(cache_file_name): '_metadata_cache.pickle')
# with open(cache_file_name, mode='rb') as fd: if os.path.exists(old_cache_file_name):
# json_metadata = cPickle.load(fd) os.remove(old_cache_file_name)
# for uuid,json_book in json_metadata.iteritems(): except:
# book = self.json_codec.raw_to_book(json_book['book'], SDBook, self.PREFIX) pass
# self.known_uuids[uuid]['book'] = book
# self.known_uuids[uuid]['last_used'] = json_book['last_used']
# lpath = book.get('lpath')
# if lpath in self.known_metadata:
# self.known_uuids.pop(uuid, None)
# else:
# self.known_metadata[lpath] = book
cache_file_name = os.path.join(cache_dir(), cache_file_name = os.path.join(cache_dir(),
'device_drivers_' + self.__class__.__name__ + 'device_drivers_' + self.__class__.__name__ +