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


PHP modResource::getCacheKey方法代码示例

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


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

示例1: process

 /**
  * Custom logic code here for setting placeholders, etc
  * @param array $scriptProperties
  * @return mixed
  */
 public function process(array $scriptProperties = array())
 {
     $placeholders = array();
     $this->resource = $this->modx->getObject('modResource', $scriptProperties['id']);
     if ($this->resource == null) {
         return $this->failure(sprintf($this->modx->lexicon('resource_with_id_not_found'), $scriptProperties['id']));
     }
     if (!$this->resource->checkPolicy('view')) {
         return $this->failure($this->modx->lexicon('access_denied'));
     }
     $this->resource->getOne('CreatedBy');
     $this->resource->getOne('EditedBy');
     $this->resource->getOne('Template');
     $server_offset_time = intval($this->modx->getOption('server_offset_time', null, 0));
     $this->resource->set('createdon_adjusted', strftime('%c', $this->resource->get('createdon') + $server_offset_time));
     $this->resource->set('editedon_adjusted', strftime('%c', $this->resource->get('editedon') + $server_offset_time));
     $this->resource->_contextKey = $this->resource->get('context_key');
     $buffer = $this->modx->cacheManager->get($this->resource->getCacheKey(), array(xPDO::OPT_CACHE_KEY => $this->modx->getOption('cache_resource_key', null, 'resource'), xPDO::OPT_CACHE_HANDLER => $this->modx->getOption('cache_resource_handler', null, $this->modx->getOption(xPDO::OPT_CACHE_HANDLER)), xPDO::OPT_CACHE_FORMAT => (int) $this->modx->getOption('cache_resource_format', null, $this->modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))));
     if ($buffer) {
         $placeholders['buffer'] = htmlspecialchars($buffer['resource']['_content']);
     }
     /* assign resource to smarty */
     $placeholders['resource'] = $this->resource;
     /* make preview url */
     $this->getPreviewUrl();
     $placeholders['_ctx'] = $this->resource->get('context_key');
     return $placeholders;
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:33,代码来源:data.class.php

示例2: getCacheSource

 public function getCacheSource()
 {
     $this->resource->_contextKey = $this->resource->get('context_key');
     $buffer = $this->modx->cacheManager->get($this->resource->getCacheKey(), array(xPDO::OPT_CACHE_KEY => $this->modx->getOption('cache_resource_key', null, 'resource'), xPDO::OPT_CACHE_HANDLER => $this->modx->getOption('cache_resource_handler', null, $this->modx->getOption(xPDO::OPT_CACHE_HANDLER)), xPDO::OPT_CACHE_FORMAT => (int) $this->modx->getOption('cache_resource_format', null, $this->modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))));
     if ($buffer) {
         $buffer = htmlspecialchars($buffer['resource']['_content']);
     }
     return !empty($buffer) ? $buffer : $this->modx->lexicon('resource_notcached');
 }
开发者ID:nervlin4444,项目名称:modx-cms,代码行数:9,代码来源:data.class.php

示例3: clearResourceCache

 /**
  * @param modResource $resource
  */
 public function clearResourceCache(&$resource)
 {
     //        $resource->clearCache();
     $resource->_contextKey = $resource->context_key;
     /** @var modCacheManager $cache */
     $cache = $this->modx->cacheManager->getCacheProvider($this->modx->getOption('cache_resource_key', null, 'resource'));
     $key = $resource->getCacheKey();
     $cache->delete($key, array('deleteTop' => true));
     $cache->delete($key);
     $this->modx->_clearResourceCache = true;
     $this->modx->cacheManager = new atCacheManager($this->modx);
 }
开发者ID:sergant210,项目名称:AdminTools,代码行数:15,代码来源:admintools.class.php


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