本文整理汇总了PHP中CPHPCache::AbortDataCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CPHPCache::AbortDataCache方法的具体用法?PHP CPHPCache::AbortDataCache怎么用?PHP CPHPCache::AbortDataCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPHPCache
的用法示例。
在下文中一共展示了CPHPCache::AbortDataCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sectionUFields
public static function sectionUFields($primary)
{
if (!$primary) {
throw new ArgumentException('Не указан идентификатор инфоблока');
}
$cache = new \CPHPCache();
$path = self::createPath(__METHOD__);
$cacheId = md5($primary . $path);
if ($cache->InitCache(86400 * 2, $cacheId, $path)) {
$uFields = $cache->GetVars();
} else {
if (!is_numeric($primary)) {
$iblock = self::iblock($primary);
if (!$iblock) {
$cache->AbortDataCache();
return null;
}
$primary = $iblock['ID'];
}
global $USER_FIELD_MANAGER;
$uFields = $USER_FIELD_MANAGER->getUserFields("IBLOCK_{$primary}_SECTION");
if ($cache->StartDataCache()) {
$cache->EndDataCache($uFields);
}
}
return $uFields;
}
示例2: array
}
}
$_SESSION['SENDER_SUBSCRIBE_LIST']['SUBSCRIPTION'] = $arSubscription;
$_SESSION['SENDER_SUBSCRIBE_LIST']['RUBRIC'] = $arSubscriptionRubrics;
}
}
//page title
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("SENDER_SUBSCR_TITLE"), array('COMPONENT_NAME' => $this->GetName()));
}
//get site's newsletter categories
$obCache = new CPHPCache();
$strCacheID = LANG . $arParams["SHOW_HIDDEN"];
if ($obCache->StartDataCache($arParams["CACHE_TIME"], $strCacheID, "/" . SITE_ID . $this->GetRelativePath())) {
if (!CModule::IncludeModule("sender")) {
$obCache->AbortDataCache();
ShowError(GetMessage("SENDER_SUBSCR_MODULE_NOT_INSTALLED"));
return;
}
$arFilter = array("SITE_ID" => SITE_ID);
if (!$arParams["SHOW_HIDDEN"]) {
$arFilter["IS_PUBLIC"] = "Y";
}
$mailingList = \Bitrix\Sender\Subscription::getMailingList($arFilter);
$obCache->EndDataCache($mailingList);
} else {
$mailingList = $obCache->GetVars();
}
if (strlen($_REQUEST["SENDER_SUBSCRIBE_EMAIL"]) > 0) {
$arResult["EMAIL"] = htmlspecialcharsbx($_REQUEST["SENDER_SUBSCRIBE_EMAIL"]);
} elseif (strlen($arSubscription["EMAIL"]) > 0) {
示例3: GetStatusList
public function GetStatusList($XML_ID = false)
{
if (is_array($this->CacheStorage["STATUS_LIST"]) && array_key_exists(intval($XML_ID), $this->CacheStorage["STATUS_LIST"])) {
return $this->CacheStorage["STATUS_LIST"][intval($XML_ID)];
}
$obCache = new CPHPCache();
$life_time = 60 * 60 * 24 * 30;
//over 1 month
$cache_id = 'idea_status_list';
//no need to keep unique all time, just caching for 1 day if no changes
$cache_path = '/' . SITE_ID . '/idea/status_list/';
$arStatus = array();
if ($obCache->StartDataCache($life_time, $cache_id, $cache_path)) {
$arStatusField = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => CIdeaManagment::UFStatusField))->Fetch();
if ($arStatusField) {
$oStatus = CUserFieldEnum::GetList(array(), array("USER_FIELD_ID" => $arStatusField["ID"]));
while ($r = $oStatus->Fetch()) {
$arStatus[$r["ID"]] = $r;
}
$obCache->EndDataCache($arStatus);
} else {
$obCache->AbortDataCache();
}
} else {
$arStatus = $obCache->GetVars();
}
if ($XML_ID) {
$arStatusXML = array();
foreach ($arStatus as $Status) {
$arStatusXML[$Status["XML_ID"]] = $Status;
}
$arStatus = $arStatusXML;
}
return $this->CacheStorage["STATUS_LIST"][intval($XML_ID)] = $arStatus;
}
示例4: obtainDataReferences
/**
* Read some data from database, using cache. Under some info we mean status list, delivery system list and so on.
* This will be a shared cache between sale.personal.order.list and sale.personal.order.detail, so beware of collisions.
* @throws Exception
* @return void
*/
protected function obtainDataReferences()
{
$obCache = new CPHPCache();
if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], LANGUAGE_ID . SITE_ID)) {
try {
$cachedData = array();
/////////////////////
/////////////////////
// Person type
$dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
while ($arPType = $dbPType->Fetch()) {
$cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
}
// Tax list
$dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"));
while ($arTaxList = $dbTaxList->Fetch()) {
$cachedData['TAX'] = $arTaxList;
}
// Save statuses for Filter form
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
while ($arStatus = $dbStatus->Fetch()) {
$cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
}
$dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
while ($arPaySystem = $dbPaySystem->Fetch()) {
$cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
}
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
while ($arDelivery = $dbDelivery->Fetch()) {
$cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
}
$dbDelivery = CSaleDeliveryHandler::GetList(array(), array(array("SITE_ID" => SITE_ID)));
while ($arDeliveryHandler = $dbDelivery->Fetch()) {
$cachedData['DELIVERY_HANDLERS'][$arDeliveryHandler["SID"]] = $arDeliveryHandler;
}
/////////////////////
/////////////////////
} catch (Exception $e) {
$obCache->AbortDataCache();
throw $e;
}
$obCache->EndDataCache($cachedData);
} else {
$cachedData = $obCache->GetVars();
}
$this->dbResult = array_merge($this->dbResult, $cachedData);
}
示例5: getHlTablesList
/**
* _getHlTablesList
* @param bool $refresh_cache
* @return bool
* @throws \Bitrix\Main\ArgumentException
*/
private function getHlTablesList($refresh_cache = false)
{
if (is_null(self::$_hlblock_list)) {
$cache = new \CPHPCache();
$cache_time = $this->getDefaultCacheTime();
$cache_id = 'getHlTablesList';
$cache_path = '/' . __CLASS__ . '/' . __METHOD__ . '/';
if (!$refresh_cache && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
self::$_hlblock_list = $cache->GetVars();
} else {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
$dbItems = HighloadBlockTable::GetList(array('select' => array('ID', 'NAME', 'TABLE_NAME')));
while ($arItem = $dbItems->Fetch()) {
self::$_hlblock_list[strtoupper($arItem['NAME'])] = $arItem;
}
if (is_null(self::$_hlblock_list)) {
$cache->AbortDataCache();
}
$cache->EndDataCache(self::$_hlblock_list);
}
}
return self::$_hlblock_list;
}