Commit bae67752 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Rename TransactionCache to ReadOnlyTransactionCache, because several people...

Rename TransactionCache to ReadOnlyTransactionCache, because several people misunderstood the purpose.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6164 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a9476a2
......@@ -37,7 +37,7 @@ from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Products.ERP5Type import Permissions
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Cache import getTransactionCache
from Products.ERP5Type.Cache import getReadOnlyTransactionCache
from Products.CMFCategory import _dtmldir
from Products.CMFCore.PortalFolder import ContentFilter
from Products.CMFCategory.Renderer import Renderer
......@@ -199,7 +199,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
Returns a Category object from a given category url
and optionnal base category id
"""
cache = getTransactionCache(self)
cache = getReadOnlyTransactionCache(self)
if cache is not None:
key = ('getCategoryValue', relative_url, base_category)
try:
......@@ -766,7 +766,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
'getSingleCategoryAcquiredMembershipList' )
def getSingleCategoryAcquiredMembershipList(self, context, base_category, base=0,
spec=(), filter=None, acquired_object_dict = None, **kw ):
cache = getTransactionCache(self)
cache = getReadOnlyTransactionCache(self)
if cache is not None:
key = ('getSingleCategoryAcquiredMembershipList', context._p_oid, base_category, base, spec,
filter, str(kw))
......@@ -1399,7 +1399,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
Finds an object from a relative_url
Method is public since we use restrictedTraverse
"""
cache = getTransactionCache(self)
cache = getReadOnlyTransactionCache(self)
if cache is not None:
key = ('resolveCategory', relative_url)
try:
......
......@@ -48,7 +48,7 @@ from Products.ERP5Type.Utils2 import _getListFor
from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5Type.Accessor import Base as BaseAccessor
from Products.ERP5Type.XMLExportImport import Base_asXML
from Products.ERP5Type.Cache import CachingMethod, clearCache, getTransactionCache
from Products.ERP5Type.Cache import CachingMethod, clearCache, getReadOnlyTransactionCache
from Products.CMFCore.WorkflowCore import ObjectDeleted
from Accessor import WorkflowState
......@@ -1224,7 +1224,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
"""
Returns the portal object
"""
cache = getTransactionCache(self)
cache = getReadOnlyTransactionCache(self)
if cache is not None:
key = 'getPortalObject'
try:
......
......@@ -153,20 +153,20 @@ def clearCache():
# 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 getTransactionCache(context):
def getReadOnlyTransactionCache(context):
"""Get the transaction cache.
"""
try:
return context.REQUEST['_erp5_transaction_cache']
return context.REQUEST['_erp5_read_only_transaction_cache']
except KeyError:
return None
def enableTransactionCache(context):
def enableReadOnlyTransactionCache(context):
"""Enable the transaction cache.
"""
context.REQUEST.set('_erp5_transaction_cache', {})
context.REQUEST.set('_erp5_read_only_transaction_cache', {})
def disableTransactionCache(context):
def disableReadOnlyTransactionCache(context):
"""Disable the transaction cache.
"""
context.REQUEST.set('_erp5_transaction_cache', None)
context.REQUEST.set('_erp5_read_only_transaction_cache', None)
......@@ -59,12 +59,12 @@ except ImportError:
psyco = None
try:
from Products.ERP5Type.Cache import enableTransactionCache, disableTransactionCache
from Products.ERP5Type.Cache import enableReadOnlyTransactionCache, disableReadOnlyTransactionCache
except ImportError:
def doNothing(context):
pass
enableTransactionCache = doNothing
disableTransactionCache = doNothing
enableReadOnlyTransactionCache = doNothing
disableReadOnlyTransactionCache = doNothing
UID_BUFFER_SIZE = 300
......@@ -1047,7 +1047,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
try:
if not disable_cache:
enableTransactionCache(self)
enableReadOnlyTransactionCache(self)
method_kw_dict = {}
for method_name in method_id_list:
......@@ -1135,7 +1135,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
raise
finally:
if not disable_cache:
disableTransactionCache(self)
disableReadOnlyTransactionCache(self)
if psyco is not None: psyco.bind(catalogObjectList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment