Mercurial > piecrust2
comparison piecrust/cache.py @ 876:d1095774bfcf
refactor: Fix some issues with record/cache entry collisions, add counters.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 15 Jun 2017 07:33:40 -0700 |
parents | 4850f8c21b6e |
children | f2b75e4be981 |
comparison
equal
deleted
inserted
replaced
875:7169bf42ec60 | 876:d1095774bfcf |
---|---|
189 item = self.cache.get(key) | 189 item = self.cache.get(key) |
190 if item is not None: | 190 if item is not None: |
191 self._hits += 1 | 191 self._hits += 1 |
192 return item | 192 return item |
193 | 193 |
194 if (self.fs_cache is not None and | 194 if self.fs_cache is not None: |
195 fs_cache_time is not None): | 195 if fs_cache_time is None: |
196 raise ValueError( | |
197 "No file-system cache time was given for '%s'. " | |
198 "This would result in degraded performance." % key) | |
199 | |
196 # Try first from the file-system cache. | 200 # Try first from the file-system cache. |
197 fs_key = _make_fs_cache_key(key) | 201 fs_key = _make_fs_cache_key(key) |
198 if (fs_key not in self._invalidated_fs_items and | 202 if (fs_key not in self._invalidated_fs_items and |
199 self.fs_cache.isValid(fs_key, fs_cache_time)): | 203 self.fs_cache.isValid(fs_key, fs_cache_time)): |
200 logger.debug("'%s' found in file-system cache." % | 204 logger.debug("'%s' found in file-system cache." % |