From 9a0583a56fcfa038207f573de14bc172cf264e3d Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Thu, 2 Nov 2006 15:14:41 +0000 Subject: [PATCH] sorry, the transaction cache was deleted, put it back git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11063 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Cache.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/product/ERP5Type/Cache.py b/product/ERP5Type/Cache.py index 6ba712647d..61441558f3 100644 --- a/product/ERP5Type/Cache.py +++ b/product/ERP5Type/Cache.py @@ -207,6 +207,27 @@ class CachingMethod: 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 @@ def clearCache(method_id=None): 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 -- 2.30.9