当前位置: 首页>>代码示例>>Python>>正文


Python RAMCacheManager.manage_addRAMCacheManager方法代码示例

本文整理汇总了Python中Products.StandardCacheManagers.RAMCacheManager.manage_addRAMCacheManager方法的典型用法代码示例。如果您正苦于以下问题:Python RAMCacheManager.manage_addRAMCacheManager方法的具体用法?Python RAMCacheManager.manage_addRAMCacheManager怎么用?Python RAMCacheManager.manage_addRAMCacheManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.StandardCacheManagers.RAMCacheManager的用法示例。


在下文中一共展示了RAMCacheManager.manage_addRAMCacheManager方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: install_RSSCache

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
def install_RSSCache(portal, out):
    if 'RSSCache' not in portal.objectIds():
        RAMCacheManager.manage_addRAMCacheManager(portal, 'RSSCache')

    portal.RSSCache.manage_editProps('RSSCache for getRSSResult', \
             settings={ 'threshold':1000,
                        'request_vars':['itemCount', 'rssUrl'],
                        'cleanup_interval':300,
                        'max_age':3600})
    out.write( "added and initalized RAMCache" )
开发者ID:Tamosauskas,项目名称:Products.CMFContentPanels,代码行数:12,代码来源:Install.py

示例2: test_customize_caching

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
    def test_customize_caching(self):
        # Test to ensure that cache manager associations survive customizing
        cache_id = "gofast"
        RAMCacheManager.manage_addRAMCacheManager(self.root, cache_id, REQUEST=None)
        self.fsDTML.ZCacheable_setManagerId(cache_id, REQUEST=None)

        self.assertEqual(self.fsDTML.ZCacheable_getManagerId(), cache_id)

        self.fsDTML.manage_doCustomize(folder_path="custom")
        custom_pt = self.custom.testDTML

        self.assertEqual(custom_pt.ZCacheable_getManagerId(), cache_id)
开发者ID:wpjunior,项目名称:proled,代码行数:14,代码来源:test_FSDTMLMethod.py

示例3: setupRAMCache

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
def setupRAMCache(portal, logger, ram_cache_id, title, age, reqvars, threshold):
    if not ram_cache_id in portal.objectIds():
        RAMCacheManager.manage_addRAMCacheManager(portal, ram_cache_id)
        cache = getattr(portal, ram_cache_id)
        settings = cache.getSettings()
        settings['max_age'] = age
        settings['request_vars'] = reqvars
        settings['threshold'] = threshold
        cache.manage_editProps(title, settings)
        logger.info(' - created RAMCache %s' % ram_cache_id)
    else:
        logger.info(' - already exists RAMCache "%s"' % ram_cache_id)
开发者ID:Rhaptos,项目名称:Products.RhaptosContent,代码行数:14,代码来源:setuphandlers.py

示例4: test_customize_caching

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
    def test_customize_caching(self):
        # Test to ensure that cache manager associations survive customizing
        cache_id = 'gofast'
        RAMCacheManager.manage_addRAMCacheManager(self.app, cache_id,
                                                  REQUEST=None)
        self.fsPT.ZCacheable_setManagerId(cache_id, REQUEST=None)

        self.assertEqual(self.fsPT.ZCacheable_getManagerId(), cache_id)

        self.fsPT.manage_doCustomize(folder_path='custom')
        custom_pt = self.custom.testPT

        self.assertEqual(custom_pt.ZCacheable_getManagerId(), cache_id)
开发者ID:zopefoundation,项目名称:Products.CMFCore,代码行数:15,代码来源:test_FSPageTemplate.py

示例5: test_customize_caching

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
    def test_customize_caching(self):
        # Test to ensure that cache manager associations survive customizing
        root, tool, custom, fsdir, fsPS = self._makeSkins()

        cache_id = "gofast"
        RAMCacheManager.manage_addRAMCacheManager(root, cache_id, REQUEST=None)
        fsPS.ZCacheable_setManagerId(cache_id, REQUEST=None)

        self.assertEqual(fsPS.ZCacheable_getManagerId(), cache_id)

        fsPS.manage_doCustomize(folder_path="custom")
        custom_ps = custom.test6

        self.assertEqual(custom_ps.ZCacheable_getManagerId(), cache_id)
开发者ID:pigaov10,项目名称:plone4.3,代码行数:16,代码来源:test_FSPythonScript.py

示例6: test_customize_caching

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
    def test_customize_caching(self):
        # Test to ensure that cache manager associations survive customizing
        from Products.StandardCacheManagers import RAMCacheManager
        cache_id = 'gofast'
        self.custom.all_meta_types = ZPT_META_TYPES
        RAMCacheManager.manage_addRAMCacheManager(self.app, cache_id,
                                                  REQUEST=None)
        self.fsReST.ZCacheable_setManagerId(cache_id, REQUEST=None)

        self.assertEqual(self.fsReST.ZCacheable_getManagerId(), cache_id)

        self.fsReST.manage_doCustomize(folder_path='custom')
        custom_pt = self.custom.testReST

        self.assertEqual(custom_pt.ZCacheable_getManagerId(), cache_id)
开发者ID:goschtl,项目名称:zope,代码行数:17,代码来源:test_FSReSTMethod.py

示例7: test_customize_caching

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
    def test_customize_caching(self):
        # Test to ensure that cache manager associations survive customizing
        _stool, custom, _fsdir, fsPS = self._makeContext('test6', 'test6.py')

        cache_id = 'gofast'
        RAMCacheManager.manage_addRAMCacheManager(self.app, cache_id,
                                                  REQUEST=None)
        fsPS.ZCacheable_setManagerId(cache_id, REQUEST=None)

        self.assertEqual(fsPS.ZCacheable_getManagerId(), cache_id)

        fsPS.manage_doCustomize(folder_path='custom')
        custom_ps = custom.test6

        self.assertEqual(custom_ps.ZCacheable_getManagerId(), cache_id)
开发者ID:zopefoundation,项目名称:Products.CMFCore,代码行数:17,代码来源:test_FSPythonScript.py

示例8: addCacheForResourceRegistry

# 需要导入模块: from Products.StandardCacheManagers import RAMCacheManager [as 别名]
# 或者: from Products.StandardCacheManagers.RAMCacheManager import manage_addRAMCacheManager [as 别名]
def addCacheForResourceRegistry(context):
    portal = getToolByName(context, 'portal_url').getPortalObject()
    ram_cache_id = 'ResourceRegistryCache'
    if not ram_cache_id in portal.objectIds():
        RAMCacheManager.manage_addRAMCacheManager(portal, ram_cache_id)
        cache = getattr(portal, ram_cache_id)
        settings = cache.getSettings()
        settings['max_age'] = 24*3600 # keep for up to 24 hours
        settings['request_vars'] = ('URL',)
        cache.manage_editProps('Cache for saved ResourceRegistry files', settings)
        logger.info('Created RAMCache %s for ResourceRegistry output' % ram_cache_id)
    reg = getToolByName(portal, 'portal_css', None)
    if reg is not None and getattr(aq_base(reg), 'ZCacheable_setManagerId', None) is not None:
        reg.ZCacheable_setManagerId(ram_cache_id)
        reg.ZCacheable_setEnabled(1)
        logger.info('Associated portal_css with %s' % ram_cache_id)
    reg = getToolByName(portal, 'portal_javascripts', None)
    if reg is not None and getattr(aq_base(reg), 'ZCacheable_setManagerId', None) is not None:
        reg.ZCacheable_setManagerId(ram_cache_id)
        reg.ZCacheable_setEnabled(1)
        logger.info('Associated portal_javascripts with %s' % ram_cache_id)
开发者ID:gbastien,项目名称:plone.app.upgrade,代码行数:23,代码来源:alphas.py


注:本文中的Products.StandardCacheManagers.RAMCacheManager.manage_addRAMCacheManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。