comparison piecrust/cache.py @ 719:a066f4ac9094

rendering: Use `fastpickle` serialization before JSON. This is because JSON loses information about stuff like tuples.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 28 May 2016 15:43:24 -0700
parents 61d606fbc313
children 4850f8c21b6e
comparison
equal deleted inserted replaced
718:d4408fbbbc7d 719:a066f4ac9094
199 if (fs_key not in self._invalidated_fs_items and 199 if (fs_key not in self._invalidated_fs_items and
200 self.fs_cache.isValid(fs_key, fs_cache_time)): 200 self.fs_cache.isValid(fs_key, fs_cache_time)):
201 logger.debug("'%s' found in file-system cache." % 201 logger.debug("'%s' found in file-system cache." %
202 key) 202 key)
203 item_raw = self.fs_cache.read(fs_key) 203 item_raw = self.fs_cache.read(fs_key)
204 item = json.loads( 204 item = json.loads(item_raw)
205 item_raw,
206 object_pairs_hook=collections.OrderedDict)
207 self.cache.put(key, item) 205 self.cache.put(key, item)
208 self._hits += 1 206 self._hits += 1
209 return item 207 return item
210 208
211 # Look into the mem-cache. 209 # Look into the mem-cache.