Minor speed up

This commit is contained in:
Miroslav Stampar 2012-07-26 15:42:04 +02:00
parent efa99c4519
commit cba387a0a0

View File

@ -6,6 +6,7 @@ See the file 'doc/COPYING' for copying permission
""" """
import hashlib import hashlib
import os
import sqlite3 import sqlite3
import threading import threading
import time import time
@ -54,7 +55,7 @@ class HashDB(object):
def retrieve(self, key, unserialize=False): def retrieve(self, key, unserialize=False):
retVal = None retVal = None
if key: if key and (self._write_cache or os.path.isfile(self.filepath)):
hash_ = HashDB.hashKey(key) hash_ = HashDB.hashKey(key)
retVal = self._write_cache.get(hash_, None) retVal = self._write_cache.get(hash_, None)
if not retVal: if not retVal: