[Erp5-report] r11063 - /erp5/trunk/products/ERP5Type/Cache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 2 16:14:42 CET 2006


Author: seb
Date: Thu Nov  2 16:14:41 2006
New Revision: 11063

URL: http://svn.erp5.org?rev=11063&view=rev
Log:
sorry, the transaction cache was deleted, put it back

Modified:
    erp5/trunk/products/ERP5Type/Cache.py

Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=11063&r1=11062&r2=11063&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Thu Nov  2 16:14:41 2006
@@ -207,6 +207,27 @@
                 
 allow_class(CachingMethod)
 
+# TransactionCache is a cache per transaction. The purpose of this cache is
+# to accelerate some heavy read-only operations. Note that this must not be
+# enabled when a trasaction may modify ZODB objects.
+def getReadOnlyTransactionCache(context):
+  """Get the transaction cache.
+  """
+  try:
+    return context.REQUEST['_erp5_read_only_transaction_cache']
+  except KeyError:
+    return None
+
+def enableReadOnlyTransactionCache(context):
+  """Enable the transaction cache.
+  """
+  context.REQUEST.set('_erp5_read_only_transaction_cache', {})
+
+def disableReadOnlyTransactionCache(context):
+  """Disable the transaction cache.
+  """
+  context.REQUEST.set('_erp5_read_only_transaction_cache', None)
+
 ########################################################
 ## Old global cache functions                         ##
 ## TODO: Check if it make sense to keep them any more ##
@@ -219,15 +240,3 @@
   otherwise, it clears the whole cache.
   """
   pass 
-
-def getReadOnlyTransactionCache(context):
-  """ Get the transaction cache.  """
-  pass
-
-def enableReadOnlyTransactionCache(context):
-  """ Enable the transaction cache. """
-  pass
-
-def disableReadOnlyTransactionCache(context):
-  """ Disable the transaction cache. """
-  pass 




More information about the Erp5-report mailing list