diff --git a/ox/file.py b/ox/file.py index 9791f81..7be0910 100644 --- a/ox/file.py +++ b/ox/file.py @@ -48,7 +48,7 @@ def _get_file_cache(): path = path[3:] return os.path.join(path, 'files.sqlite') -def cache(filename, type='oshash'): +def cache(filename, type='oshash', update=False): conn = sqlite3.connect(_get_file_cache(), timeout=10) conn.row_factory = sqlite3.Row @@ -68,11 +68,12 @@ def cache(filename, type='oshash'): info = '' for row in c: if stat.st_size == row['size'] and int(stat.st_mtime) == int(row['mtime']): - value = row[type] - if value: - if type == 'info': - value = json.loads(value) - return value + if not update: + value = row[type] + if value: + if type == 'info': + value = json.loads(value) + return value h = row['oshash'] sha1 = row['sha1'] info = row['info']