本文整理汇总了PHP中CPHPCache::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP CPHPCache::clean方法的具体用法?PHP CPHPCache::clean怎么用?PHP CPHPCache::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPHPCache
的用法示例。
在下文中一共展示了CPHPCache::clean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: workWithNonCacheAttr
/**
* Set mutable attributes
* @param bool $bFromCache
* @param string $strUserIds
*/
protected function workWithNonCacheAttr($bFromCache = false, $strUserIds = '')
{
//if list of users in cache - get last activity
if ($bFromCache && $strUserIds) {
$dbRes = CUser::getList($by = 'id', $order = 'asc', array('ID' => $strUserIds, 'LAST_ACTIVITY' => static::LAST_ACTIVITY), array('FIELDS' => array('ID')));
while ($arRes = $dbRes->fetch()) {
if ($this->arResult['USERS'][$arRes['ID']]) {
$this->arResult['USERS'][$arRes['ID']]['IS_ONLINE'] = true;
}
}
unset($dbRes, $arRes);
}
$buildResizedPhoto = false;
$displayPhoto = $this->displayPersonalPhoto();
foreach ($this->arResult['USERS'] as &$arUser) {
if ($this->bExcel && $displayPhoto) {
//if export in excel, then method $this->resizePersonalPhoto() not run. And not modify PERSONAL_PHOTO
if (!$arUser['PERSONAL_PHOTO']) {
$arUser['PERSONAL_PHOTO'] = $this->getDefaultPictureSonet($arUser['PERSONAL_GENDER']);
}
$arUser['PERSONAL_PHOTO_SOURCE'] = $arUser['PERSONAL_PHOTO'];
$arUser['PERSONAL_PHOTO'] = CFile::GetPath($arUser['PERSONAL_PHOTO']);
} elseif ($bFromCache && $displayPhoto) {
$buildResizedPhoto = $this->resizePersonalPhoto($arUser) || $buildResizedPhoto;
}
$arUser['IS_BIRTHDAY'] = CIntranetUtils::IsToday($arUser['PERSONAL_BIRTHDAY']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
}
//rewrite cache if we build new resized photo
if ($buildResizedPhoto) {
$this->obCache->clean($this->cacheId, $this->cacheDir);
$this->obCache->startDataCache();
$this->obCache->endDataCache(array('USERS' => $this->arResult['USERS'], 'STR_USER_ID' => $strUserIds, 'DEPARTMENTS' => $this->arResult['DEPARTMENTS'], 'DEPARTMENT_HEAD' => $this->arResult['DEPARTMENT_HEAD'], 'USERS_NAV' => $this->arResult['USERS_NAV']));
}
}
示例2: getObject
public function getObject($id, $code, $sectionCode = false, $iblock = false, $clear_cache = "N")
{
$id = (int) $id;
$cache = new CPHPCache();
if ($id) {
$arFilter = array("ID" => $id);
$cacheId = "object_" . $id . $sectionCode;
$cachePath = "/" . SITE_ID . "/object/" . substr($id, 0, 3);
} else {
$arFilter = array("=CODE" => $code);
$cacheId = "object_" . $code . $sectionCode;
$cachePath = "/" . SITE_ID . "/object/" . substr($code, 0, 3);
}
if ($sectionCode) {
$arFilter["SECTION_CODE"] = $sectionCode;
$arFilter["!SECTION_ID"] = false;
}
if ($iblock) {
$arFilter["IBLOCK_ID"] = $iblock;
}
// чистим кеш?
if ('Y' == $clear_cache) {
CPHPCache::clean($cacheId, $cachePath);
}
$cacheTime = CACHE_OBJECT;
if ($cache->InitCache($cacheTime, $cacheId, $cachePath)) {
$vars = $cache->GetVars();
$obj = $vars["OBJECT"];
return $obj;
} else {
$res = CIBlockElement::GetList(array(), $arFilter);
if ($elem = $res->GetNextElement()) {
$obj = $elem->GetFields();
$props = $elem->GetProperties();
$obj["PROPS"] = $props;
if ($cache->StartDataCache()) {
$cache->EndDataCache(array("OBJECT" => $obj));
}
return $obj;
}
}
return null;
}
示例3: clearResultCache
/**
* Function deletes the cache created before.
*
* <p>Note: parameters must exactly match to startResultCache call.</p>
* @param mixed $additionalCacheID
* @param string $cachePath
* @return void
*
*/
final public function clearResultCache($additionalCacheID = false, $cachePath = false)
{
global $APPLICATION, $CACHE_MANAGER;
if (!$this->__bInited)
return null;
$this->__cacheID = $this->getCacheID($additionalCacheID);
$this->__cachePath = $cachePath;
if ($this->__cachePath === false)
$this->__cachePath = $CACHE_MANAGER->getCompCachePath($this->__relativePath);
CPHPCache::clean($this->__cacheID, $this->__cachePath);
}
示例4: clearResultCache
/**
* Function deletes the cache created before.
*
* <p>Note: parameters must exactly match to startResultCache call.</p>
* @param mixed $additionalCacheID
* @param string|bool $cachePath
* @return void
*
*/
public final function clearResultCache($additionalCacheID = false, $cachePath = false)
{
global $CACHE_MANAGER;
if (!$this->__bInited) {
return null;
}
$this->__cacheID = $this->getCacheID($additionalCacheID);
$this->__cachePath = $cachePath;
if ($this->__cachePath === false) {
$this->__cachePath = $CACHE_MANAGER->getCompCachePath($this->__relativePath);
}
$cache = new CPHPCache();
$cache->clean($this->__cacheID, $this->__cachePath);
}
示例5: clearCache
/**
* Cleans active A/B-test cache
*
* @param int $siteId Site ID.
* @return void
*/
public static function clearCache($siteId)
{
$cache = new \CPHPCache();
$cache->clean('abtest_active_' . $siteId, '/abtest');
}