當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。