diff piecrust/app.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 08e02c2a2a1a
children 13e8b50a2113
line wrap: on
line diff
--- a/piecrust/app.py	Thu Jun 15 07:32:19 2017 -0700
+++ b/piecrust/app.py	Thu Jun 15 07:33:40 2017 -0700
@@ -48,6 +48,9 @@
         stats.registerTimer("PageRenderSegments")
         stats.registerTimer("PageRenderLayout")
         stats.registerTimer("PageSerialize")
+        stats.registerCounter('PageLoads')
+        stats.registerCounter('PageRenderSegments')
+        stats.registerCounter('PageRenderLayout')
 
     @cached_property
     def config(self):
@@ -215,7 +218,7 @@
         return None
 
     def getPage(self, source, content_item):
-        cache_key = content_item.spec
+        cache_key = '%s@%s' % (source.name, content_item.spec)
         return self.env.page_repository.get(
             cache_key,
             lambda: Page(source, content_item))