本文整理汇总了PHP中CPHPCache::Clean方法的典型用法代码示例。如果您正苦于以下问题:PHP CPHPCache::Clean方法的具体用法?PHP CPHPCache::Clean怎么用?PHP CPHPCache::Clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPHPCache
的用法示例。
在下文中一共展示了CPHPCache::Clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadConfig
public function loadConfig()
{
//todo fix empty config caching
$cache = new \CPHPCache();
$cacheFile = $_SERVER['DOCUMENT_ROOT'] . "/bitrix/cache/" . $cache->GetPath(__CLASS__);
// проверяем, обновлялся ли конфиг
$cacheWritten = filemtime($cacheFile);
$configWritten = filemtime($this->configFile);
// устаревший кеш или неудачно начатый кеш перезаписываем
if ($configWritten > $cacheWritten || !$cache->InitCache(self::TTL, __CLASS__, '/')) {
$cache->Clean(__CLASS__, '/');
try {
parent::loadConfig();
if ($cache->StartDataCache(self::TTL, __CLASS__, '/')) {
$cache->EndDataCache(array('config' => $this->config));
} else {
_log('Caching failed', 'widgets');
}
} catch (Exception $e) {
_log('loading config error: ' . $e->getMessage(), 'widgets');
}
} else {
$vars = $cache->GetVars();
$this->config = $vars['config'];
}
}
示例2:
function __blogcleartagsimportant($options, $cache_id, $cache_path)
{
$obCache = new CPHPCache;
if ($cache_id != "")
$obCache->Clean($cache_id, $cache_path);
else
$obCache->CleanDir($cache_path);
}
示例3: set
/**
* @param $name
* @param $value
* @param int $time
*/
public function set($name, $value, $time = 3600)
{
$cache = new \CPHPCache();
list($dir, $name) = $this->dirAndName($name);
$cache->InitCache($time, $name, $dir);
$cache->Clean($name, $dir);
$cache->StartDataCache();
$cache->EndDataCache(array('value' => $value));
}
示例4: Clean
public static function Clean($uniq_str, $initdir = false, $basedir = "cache")
{
if (is_object($this) && $this instanceof CPHPCache) {
return $this->cache->clean($uniq_str, $initdir, $basedir);
} else {
$obCache = new CPHPCache();
return $obCache->Clean($uniq_str, $initdir, $basedir);
}
}
示例5: Set
function Set($user_id, $type)
{
global $DB;
$user_id = intval($user_id);
if ($user_id <= 0) {
return false;
}
if ($type != "Y") {
$type = "N";
}
$strSQL = "\n\t\t\tINSERT INTO b_sonet_log_smartfilter (USER_ID, TYPE)\n\t\t\tVALUES (" . $user_id . ", '" . $type . "')\n\t\t\tON DUPLICATE KEY UPDATE TYPE = '" . $type . "'\n\t\t";
$res = $DB->Query($strSQL, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
if ($res) {
CPHPCache::Clean('sonet_smartfilter_default_' . $user_id, '/sonet/log_smartfilter/');
}
}
示例6: Add
static function Add($arFields)
{
global $DB;
if (!self::CheckFields('ADD', $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_socialservices_user", $arFields);
$strSql = "INSERT INTO b_socialservices_user (" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$res = $DB->Query($strSql, true, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (!$res) {
$_SESSION["LAST_ERROR"] = GetMessage("SC_ADD_ERROR");
return false;
}
$lastId = intval($DB->LastID());
$cache_id = 'socserv_ar_user';
$obCache = new CPHPCache();
$cache_dir = '/bx/socserv_ar_user';
$obCache->Clean($cache_id, $cache_dir);
$events = GetModuleEvents("socialservices", "OnAfterSocServUserAdd");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
return $lastId;
}
示例7: CanAccessFiles
static function CanAccessFiles($iblock_id, $entity_type, $entity_id)
{
$result = false;
$iblock_id = intval($iblock_id);
$entity_id = intval($entity_id);
if ($iblock_id > 0 && $entity_id > 0 && ($entity_type == 'group' || $entity_type == 'user')) {
//cache
$value = false;
static $data = array();
$CACHE_PATH = "/" . SITE_ID . "/webdav/can_access_files";
$CACHE_ID = $iblock_id;
$CACHE_TIME = 3600 * 24 * 30;
$docCache = new CPHPCache();
if (!isset($data[$iblock_id])) {
if ($docCache->InitCache($CACHE_TIME, $CACHE_ID, $CACHE_PATH)) {
$value = $docCache->GetVars();
}
$data[$iblock_id] = $value;
}
if (isset($data[$iblock_id][$entity_type][$entity_id])) {
return $data[$iblock_id][$entity_type][$entity_id];
}
//end cache
CModule::IncludeModule('iblock');
$rIB = CIBlock::GetList(array(), array('ID' => $iblock_id, "CHECK_PERMISSIONS" => "N"));
if ($rIB && ($arIB = $rIB->Fetch()) && $arIB["RIGHTS_MODE"] === "E") {
$rootSectionID = self::GetSectionID($iblock_id, $entity_type, $entity_id);
if ($rootSectionID !== false) {
$ibRights = new CIBlockSectionRights($iblock_id, $rootSectionID);
$result = $ibRights->UserHasRightTo($iblock_id, $rootSectionID, 'section_read');
if (!$result) {
$arParams = array("DOCUMENT_TYPE" => array("webdav", "CIBlockDocumentWebdavSocnet", implode("_", array("iblock", $iblock_id, $entity_type, $entity_id))), "ROOT_SECTION_ID" => $rootSectionID, "ATTRIBUTES" => $entity_type == "user" ? array('user_id' => $entity_id) : array('group_id' => $entity_id));
$ob = new CWebDavIblock($iblock_id, '', $arParams);
if ($ob && empty($ob->arError) && $ob->permission > 'D') {
$files = array();
$options = array("path" => '/', "depth" => 1);
$res = $ob->PROPFIND($options, $files, array("return" => "array"));
$result = is_array($res) && sizeof($res['RESULT']) > 0;
// at least 1 item can be read
}
}
} else {
return true;
}
} else {
$result = CIBlock::GetPermission($iblock_id) > "D";
}
// cache
if ($data[$iblock_id] === false) {
$data[$iblock_id] = array();
}
$data[$iblock_id][$entity_type][$entity_id] = $result;
$docCache->Clean($CACHE_ID, $CACHE_PATH);
$docCache->InitCache($CACHE_TIME, $CACHE_ID, $CACHE_PATH);
if ($docCache->StartDataCache()) {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($CACHE_PATH);
$CACHE_MANAGER->RegisterTag("iblock_id_" . $iblock_id);
$CACHE_MANAGER->RegisterTag('wd_socnet');
$CACHE_MANAGER->EndTagCache();
$docCache->EndDataCache($data[$iblock_id]);
}
// end cache
}
return $result;
}
示例8: Add
static function Add($arFields)
{
global $DB;
if (!self::CheckFields('ADD', $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_socialservices_message", $arFields);
$strSql = "INSERT INTO b_socialservices_message (" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$res = $DB->Query($strSql, true, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (!$res) {
return false;
}
$lastId = intval($DB->LastID());
$cache_id = 'socserv_mes_user';
$obCache = new CPHPCache();
$cache_dir = '/bx/socserv_mes_user';
$obCache->Clean($cache_id, $cache_dir);
return $lastId;
}
示例9: Delete
static function Delete($id)
{
global $DB;
$id = intval($id);
if ($id > 0) {
$rsUser = $DB->Query("SELECT ID FROM b_socialservices_message WHERE ID=" . $id);
$arUser = $rsUser->Fetch();
if (!$arUser) {
return false;
}
/* $db_events = GetModuleEvents("socialservices", "OnBeforeSocServUserDelete");
while($arEvent = $db_events->Fetch())
ExecuteModuleEventEx($arEvent, array($id));*/
$DB->Query("DELETE FROM b_socialservices_message WHERE ID = " . $id . " ", true);
$cache_id = 'socserv_mes_user';
$obCache = new CPHPCache();
$cache_dir = '/bx/socserv_mes_user';
$obCache->Clean($cache_id, $cache_dir);
return true;
}
return false;
}
示例10: Save
function Save()
{
if (defined("BITRIX_SKIP_STACK_CACHE") && BITRIX_SKIP_STACK_CACHE) {
return;
}
global $DB;
if (!$this->cleanSet || !$this->cleanGet && count($this->values) >= $this->len) {
$objCache = new CPHPCache();
$objCache->Clean($this->entity, $DB->type . "/" . $this->entity, "stack_cache");
if ($objCache->StartDataCache($this->ttl, $this->entity, $DB->type . "/" . $this->entity, $this->values, "stack_cache")) {
$objCache->EndDataCache();
}
$this->cleanGet = true;
$this->cleanSet = true;
}
}
示例11: CleanChatCache
static function CleanChatCache($userId)
{
$bColorEnabled = IM\Color::isEnabled();
$cache_id = 'im_chats_v4_' . $userId . '_' . $bColorEnabled;
$obCLCache = new CPHPCache();
$cache_dir = '/bx/imc/chats';
$obCLCache->Clean($cache_id, $cache_dir);
}
示例12: foreach
return $arIBlockSection;
}
}
return false;
}
foreach ($arResult["CATEGORIES"] as $category_id => $arCategory) {
foreach ($arCategory["ITEMS"] as &$arItem) {
$pathResizeImage = NULL;
$image = NULL;
$arElement = NULL;
$section = NULL;
$arIBlockSection = NULL;
if (CModule::IncludeModule("iblock")) {
$cache_id = 'ajax-search-w' . $arItem['ITEM_ID'];
if ($_REQUEST["clear_cache"] == "Y") {
CPHPCache::Clean($cache_id, "/");
}
if ($obCache->InitCache($arParams["CACHE_TIME"], $cache_id, "/")) {
$vars = $obCache->GetVars();
$pathResizeImage = $vars["PRODUCT_PICTURE_SRC"];
$section = $vars["SECTION"];
} else {
if ($arItem['ITEM_ID'][0] == "S") {
$section = array();
$section_id = intval(substr($arItem['ITEM_ID'], 1));
$arIBlockSection = GetIBlockSection2($section_id);
$image = CFile::GetFileArray($arIBlockSection["PICTURE"]);
$image = $image["SRC"];
if (!$image) {
$section["NOT_IMAGE"] = true;
}
示例13: Delete
static function Delete($id)
{
global $DB;
$id = intval($id);
if ($id > 0)
{
$rsUser = $DB->Query("SELECT ID FROM b_socialservices_message WHERE ID=".$id);
$arUser = $rsUser->Fetch();
if(!$arUser)
return false;
$DB->Query("DELETE FROM b_socialservices_message WHERE ID = ".$id." ", true);
$cache_id = 'socserv_mes_user';
$obCache = new CPHPCache;
$cache_dir = '/bx/socserv_mes_user';
$obCache->Clean($cache_id, $cache_dir);
return true;
}
return false;
}
示例14: CleanChatCache
static function CleanChatCache($userId)
{
$cache_id = 'im_contact_list_chats_' . $userId . '_v1';
$obCLCache = new CPHPCache();
$cache_dir = '/bx/imc/chats';
$obCLCache->Clean($cache_id, $cache_dir);
}
示例15: GetMessage
BXTIMEMAN.WND.SOCSERV_WND = new BX.SocservTimeman();
BXTIMEMAN.WND.SOCSERV_WND.showWnd();
});
<?
}
}
elseif($_REQUEST['action'] == "saveuserdata")
{
if(isset($_POST["ENABLED"]))
{
$userSocServSendEnable = $_POST["ENABLED"];
CUserOptions::SetOption("socialservices","user_socserv_enable",$userSocServSendEnable, false, $userId);
$cache_id = 'socserv_user_option_'.$userId;
$obCache = new CPHPCache;
$cache_dir = '/bx/socserv_user_option';
$obCache->Clean($cache_id, $cache_dir);
}
else
{
$arUserSocServ = '';
$userSocServSendEnable = $userSocServSendStart = $userSocServSendEnd = 'N';
$userSocServEndText = GetMessage("JS_CORE_SS_WORKDAY_END");
$userSocServStartText = GetMessage("JS_CORE_SS_WORKDAY_START");
if(isset($_POST["SOCSERVARRAY"]) && !empty($_POST["SOCSERVARRAY"]))
$arUserSocServ = serialize($_POST["SOCSERVARRAY"]);
if(isset($_POST["STARTSEND"]))
$userSocServSendStart = $_POST["STARTSEND"];
if(isset($_POST["ENDSEND"]))
$userSocServSendEnd = $_POST["ENDSEND"];
if(isset($_POST["STARTTEXT"]))
$userSocServStartText = $_POST["STARTTEXT"];