Commit bb1a3bf2 authored by Aurel's avatar Aurel

define cache factory

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13084 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7b418fdb
......@@ -86,7 +86,8 @@ def getFieldDescription():\n
return property.get(\'description\', \'\')\n
return desc\n
\n
getFieldDescription = CachingMethod(getFieldDescription, (\'getFieldDescription\', form_id, field_id), cache_duration=None)\n
getFieldDescription = CachingMethod(getFieldDescription, (\'getFieldDescription\', form_id, field_id), \\\n
cache_factory=\'erp5_user_interface_long\')\n
\n
return getFieldDescription()\n
</string> </value>
......@@ -144,7 +145,6 @@ return getFieldDescription()\n
<string>_getattr_</string>
<string>field_id</string>
<string>getFieldDescription</string>
<string>None</string>
</tuple>
</value>
</item>
......
......@@ -74,7 +74,7 @@ navigation_box_render = CachingMethod(navigation_box_render,\n
("ERP5Site_renderCachedNavigationBox",\n
context.portal_membership.getAuthenticatedMember().getUserName(),\n
context.Localizer.get_selected_language()\n
),cache_duration=300)\n
),cache_factory=\'erp5_user_interface_short\')\n
return navigation_box_render()\n
</string> </value>
</item>
......
......@@ -122,7 +122,7 @@ def getFormGroupTitleAndId():\n
\n
getFormGroupTitleAndId = CachingMethod(getFormGroupTitleAndId,\n
("ERP5Site_getFormGroupTitleAndId", form.id, form.get_groups(include_empty=0)),\n
cache_duration=None)\n
cache_factory=\'erp5_user_interface_long\')\n
return getFormGroupTitleAndId()\n
</string> </value>
</item>
......@@ -178,7 +178,6 @@ return getFormGroupTitleAndId()\n
<string>form</string>
<string>getFormGroupTitleAndId</string>
<string>_getattr_</string>
<string>None</string>
</tuple>
</value>
</item>
......
340
\ No newline at end of file
345
\ No newline at end of file
......@@ -140,7 +140,8 @@ class PreferenceMethod(Method) :
if found :
return value
_getPreference = CachingMethod( _getPreference,
id='PreferenceTool.CachingMethod.%s' % self._preference_name)
id='PreferenceTool.CachingMethod.%s' % self._preference_name,
cache_factory='erp5_user_interface_short')
user_name = getSecurityManager().getUser().getId()
return _getPreference(user_name=user_name)
......@@ -236,7 +237,7 @@ class PreferenceTool(BaseTool):
return acceptable_templates
_getDocumentTemplateList = CachingMethod(_getDocumentTemplateList,
'portal_preferences.getDocumentTemplateList',
cache_duration=3000)
cache_factory='erp5_user_interface_medium')
allowed_content_types = map(lambda pti: pti.id,
folder.allowedContentTypes())
......
......@@ -233,7 +233,8 @@ class OOoDocument(File, ConversionCacheMixin):
return [[y,x] for x,y in allowed] # have to reverse tuple order
cached_getTargetFormatItemList = CachingMethod(cached_getTargetFormatItemList,
id = "OOoDocument_getTargetFormatItemList" )
id = "OOoDocument_getTargetFormatItemList",
cache_factory='erp5_core_short')
return cached_getTargetFormatItemList(self.getContentType())
security.declareProtected(Permissions.AccessContentsInformation, 'getTargetFormatList')
......
......@@ -179,7 +179,8 @@ class ERP5GroupManager(BasePlugin):
if not NO_CACHE_MODE:
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
id='ERP5GroupManager_getGroupsForPrincipal')
id='ERP5GroupManager_getGroupsForPrincipal',
cache_factory='erp5_core_short')
return _getGroupsForPrincipal(
user_name=principal.getId(),
......
......@@ -108,7 +108,8 @@ class ERP5UserManager(BasePlugin):
return None
_authenticateCredentials = CachingMethod(_authenticateCredentials,
id='ERP5UserManager_authenticateCredentials')
id='ERP5UserManager_authenticateCredentials',
cache_factory='erp5_core_short')
return _authenticateCredentials(
login=credentials.get('login'),
password=credentials.get('password'),
......@@ -152,7 +153,8 @@ class ERP5UserManager(BasePlugin):
return tuple(user_info)
_enumerateUsers = CachingMethod(_enumerateUsers,
id='ERP5UserManager_enumerateUsers')
id='ERP5UserManager_enumerateUsers',
cache_factory='erp5_core_short')
if id is None:
id = login
......
......@@ -104,7 +104,7 @@ def _evaluateTales(instance=None, value=None):
econtext = createExpressionContext(instance)
return expression(econtext)
evaluateTales = CachingMethod(_evaluateTales, id = 'evaluateTales', cache_duration=300)
evaluateTales = CachingMethod(_evaluateTales, id = 'evaluateTales', cache_factory='erp5_core_short')
class Getter(Method):
"""
......
......@@ -967,6 +967,7 @@ class Base( CopyContainer,
self._aq_dynamic('id') # Make sure _aq_dynamic has been called once
if hasattr(Base.aq_portal_type[self.portal_type], accessor_name):
method = getattr(self, accessor_name)
LOG("Base.py", 0, "method = %s, name = %s" %(method, accessor_name))
method(value, **kw)
return
if hasattr(Base.aq_portal_type[self.portal_type], public_accessor_name):
......@@ -2314,7 +2315,8 @@ class Base( CopyContainer,
return getattr(ti, 'acquire_local_roles', True)
cached_getAcquireLocalRoles = CachingMethod(cached_getAcquireLocalRoles,
id='Base__getAcquireLocalRoles')
id='Base__getAcquireLocalRoles',
cache_factory='erp5_core_short')
return cached_getAcquireLocalRoles(portal_type=self.getPortalType())
security.declareProtected(Permissions.View, 'get_local_permissions')
......@@ -2588,7 +2590,8 @@ class Base( CopyContainer,
cached_getQuantityPrecisionFromResource = CachingMethod(
cached_getQuantityPrecisionFromResource,
id='Base_getQuantityPrecisionFromResource')
id='Base_getQuantityPrecisionFromResource',
cache_factory='erp5_core_short')
return cached_getQuantityPrecisionFromResource(resource)
......
......@@ -33,7 +33,7 @@ from CachePlugins.BaseCache import CachedMethodError
from zLOG import LOG, WARNING
DEFAULT_CACHE_SCOPE = 'GLOBAL'
DEFAULT_CACHE_FACTORY = 'erp5_user_interface'
DEFAULT_CACHE_FACTORY = 'erp5_user_interface_short'
is_cache_initialized = 0
def initializePortalCachingProperties(self):
......
......@@ -91,7 +91,7 @@ class PortalTypeClass(Constraint):
_getClassForPortalTypeCache = CachingMethod(
_getClassForPortalTypeCache,
"PortalTypeClass._getClassForPortalTypeCache",
cache_duration = 60 * 10
cache_factory = 'erp5_core_medium'
)
return _getClassForPortalTypeCache(obj.getPortalType())
......@@ -689,7 +689,7 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
_getVisibleAllowedContentTypeList = CachingMethod(
_getVisibleAllowedContentTypeList,
id=("_getAllowedContentTypeTitleList", user, portal_path, portal_type),
cache_duration=None)
cache_factory='erp5_core_long')
return _getVisibleAllowedContentTypeList()
security.declarePublic('allowedContentTypes')
......
......@@ -1016,7 +1016,7 @@ class Catalog( Folder,
keys = keys.keys()
keys.sort()
return keys
return CachingMethod(_getColumnIds, id='SQLCatalog.getColumnIds', cache_duration=None)()
return CachingMethod(_getColumnIds, id='SQLCatalog.getColumnIds', cache_factory='erp5_core_long')()
def getColumnMap(self):
"""
......@@ -1035,7 +1035,7 @@ class Catalog( Folder,
if not keys.has_key(key): keys[key] = []
keys[key].append(table) # Is this inconsistent ?
return keys
return CachingMethod(_getColumnMap, id='SQLCatalog.getColumnMap', cache_duration=None)()
return CachingMethod(_getColumnMap, id='SQLCatalog.getColumnMap', cache_factory='erp5_core_long')()
def getResultColumnIds(self):
"""
......@@ -1696,7 +1696,7 @@ class Catalog( Folder,
%(table_index, table))
return table_index
return CachingMethod(_getTableIndex, id='SQLCatalog.getTableIndex', \
cache_duration=None)(table=table)
cache_factory='erp5_core_long')(table=table)
def getIndex(self, table, column_list):
......@@ -1731,7 +1731,7 @@ class Catalog( Folder,
LOG("SQLCatalog.getIndex", ERROR, "best_index = %s for table %s and columns %s" \
%(best_index, table, column_list))
return best_index
return CachingMethod(_getIndex, id='SQLCatalog.getIndex', cache_duration=None)\
return CachingMethod(_getIndex, id='SQLCatalog.getIndex', cache_factory='erp5_core_long')\
(table=table, column_list=column_list)
def buildSQLQuery(self, query_table='catalog', REQUEST=None,
......
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