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


PHP cache_key函数代码示例

本文整理汇总了PHP中cache_key函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_key函数的具体用法?PHP cache_key怎么用?PHP cache_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_cache

/**
 * Try to pull the cache for a repo
 *
 * @param Repository $repo
 * @return array|false
 */
function get_cache(Repository $repo)
{
    $key = cache_key($repo);
    $data = get_transient($key);
    if ($data !== false) {
        return json_decode($data, true);
    }
    return false;
}
开发者ID:meatwad5675,项目名称:milestones,代码行数:15,代码来源:cache.php

示例2: cache_file_script

function cache_file_script($template, $key = array(), $racine = 0, $write = true)
{
    //print $racine;
    $key_file_md5 = cache_key($key);
    ob_start();
    //print "tpl/script/".$template;
    if (file_exists($_SERVER["DOCUMENT_ROOT"] . __racine__ . "/tpl/script/" . $template)) {
        require $_SERVER["DOCUMENT_ROOT"] . __racine__ . "/tpl/script/" . $template;
    }
    if (file_exists($_SERVER["DOCUMENT_ROOT"] . __racine__ . "/tpl/layout/" . $template)) {
        require $_SERVER["DOCUMENT_ROOT"] . __racine__ . "/tpl/layout/" . $template;
    }
    $content = ob_get_contents();
    ob_end_clean();
    $racine = $racine === 0 ? $template : $racine;
    //sauvegarde du fichier
    if ($write) {
        $fp = fopen($_SERVER["DOCUMENT_ROOT"] . __cachefolder__ . str_replace("/", "_", $racine) . "_" . __defaultfather__ . "_" . $key_file_md5 . ".html", "w");
        fwrite($fp, $content);
        fclose($fp);
    }
    print $content;
}
开发者ID:jcmwc,项目名称:fleet,代码行数:23,代码来源:function_cache.php

示例3: extract_values

<?php

// Необходима функция creatureinfo
require_once 'includes/allnpcs.php';
require_once 'includes/allreputation.php';
$smarty->config_load($conf_file, 'npc');
@(list($type) = extract_values($podrazdel));
$cache_key = cache_key($type);
if (!($npcs = load_cache(NPC_LISTING, $cache_key))) {
    unset($npcs);
    $rows = $DB->select('
		SELECT c.?#, c.entry
		{
			, l.name_loc?d AS name_loc
			, l.subname_loc?d AS subname_loc
		}
		FROM ?_factiontemplate, creature_template c
		{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
		WHERE
			factiontemplateID=faction_A
			{AND type=?}
		ORDER BY minlevel DESC, name
		{LIMIT ?d}
		', $npc_cols[0], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, $type != '' ? $type : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
    $npcs = array();
    foreach ($rows as $row) {
        $npcs[] = creatureinfo2($row);
    }
    save_cache(NPC_LISTING, $cache_key, $npcs);
}
if (!($npc_tot = load_cache(NPC_TOT, 'npc_tot'))) {
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:31,代码来源:npcs.php

示例4: intval

<?php

// Необходима функция questinfo
require_once 'includes/allquests.php';
require_once 'includes/allobjects.php';
require_once 'includes/allnpcs.php';
require_once 'includes/allcomments.php';
require_once 'includes/allachievements.php';
require_once 'includes/allevents.php';
require_once 'includes/allscreenshots.php';
$smarty->config_load($conf_file, 'quest');
// Номер квеста
$id = intval($podrazdel);
$cache_key = cache_key($id);
if (!($quest = load_cache(QUEST_PAGE, $cache_key))) {
    unset($quest);
    // Основная инфа
    $quest = GetDBQuestInfo($id, 0xffffff);
    /*              ЦЕПОЧКА КВЕСТОВ              */
    // Добавляем сам квест в цепочку
    $quest['series'] = array(array('entry' => $quest['entry'], 'Title' => $quest['Title'], 'NextQuestInChain' => $quest['NextQuestInChain']));
    // Квесты в цепочке до этого квеста
    $tmp = $quest['series'][0];
    while ($tmp) {
        $tmp = $DB->selectRow('
			SELECT q.entry, q.Title
				{, l.Title_loc?d as Title_loc}
			FROM quest_template q
				{LEFT JOIN (locales_quest l) ON l.entry=q.entry AND ?d}
			WHERE q.NextQuestInChain=?d
			LIMIT 1
开发者ID:Kheros,项目名称:tc_aowow,代码行数:31,代码来源:quest.php

示例5: cache_key

<?php

require_once 'includes/allitemsets.php';
$smarty->config_load($conf_file, 'itemset');
$cache_key = cache_key();
if (!($itemsets = load_cache(ITEMSET_LISTING, $cache_key))) {
    unset($itemsets);
    $rows = $DB->select('
		SELECT ?#
		FROM ?_itemset
		ORDER by name_loc' . $_SESSION['locale'] . '
		{LIMIT ?d}', $itemset_col[0], $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
    $itemsets = array();
    foreach ($rows as $row) {
        $itemsets[] = itemsetinfo2($row);
    }
    save_cache(ITEMSET_LISTING, $cache_key, $itemsets);
}
$smarty->assign('itemsets', $itemsets);
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Item_Sets'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => '[0, 2]');
$smarty->assign('page', $page);
// --Передаем данные шаблонизатору--
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Запускаем шаблонизатор
$smarty->display('itemsets.tpl');
开发者ID:saqar,项目名称:tc_aowow,代码行数:27,代码来源:itemsets.php

示例6: extract_values

<?php

require_once 'includes/allachievements.php';
$smarty->config_load($conf_file, 'achievement');
@(list($category) = extract_values($podrazdel));
$cache_key = cache_key($category);
if (!($achievements = load_cache(24, $cache_key))) {
    unset($achievements);
    $rows = $DB->select('
			SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID
			FROM ?_spellicons s, ?_achievement a
			LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
			WHERE
				a.icon = s.id
				{ AND a.category = ? }
			GROUP BY a.id
			ORDER BY a.`order` ASC
		', $_SESSION['locale'], $_SESSION['locale'], isset($category) ? $category : DBSIMPLE_SKIP);
    if ($rows) {
        $achievements = array();
        $achievements['data'] = array();
        foreach ($rows as $row) {
            $achievements['data'][] = achievementinfo2($row);
        }
        if (isset($category)) {
            $catrow = $DB->selectRow('
					SELECT c1.id, c1.name_loc?d AS name, c2.id AS id2
					FROM ?_achievementcategory c1
					LEFT JOIN (?_achievementcategory c2) ON c1.parentAchievement != -1 AND c1.parentAchievement = c2.id
					WHERE
						c1.id = ?
开发者ID:Brueggus,项目名称:aowow,代码行数:31,代码来源:achievements.php

示例7: extract_values

<?php

// Необходима функция iteminfo
require_once 'includes/allitems.php';
$smarty->config_load($conf_file, 'items');
// Разделяем из запроса класс, подкласс и тип вещей
@(list($class, $subclass, $type) = extract_values($podrazdel));
$cache_key = cache_key($class, $subclass, $type);
if (!($items = load_cache(7, $cache_key))) {
    unset($items);
    // Составляем запрос к БД, выполняющий поиск по заданным классу и подклассу
    $rows = $DB->select('
		SELECT ?#, i.entry, maxcount
			{, l.name_loc?d AS name_loc}
		FROM ?_icons, item_template i
			{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
		WHERE
			id=displayid
			{ AND class = ? }
			{ AND subclass = ? }
			{ AND InventoryType = ? }
		ORDER BY quality DESC, name
		{ LIMIT ?d }
		', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, isset($class) ? $class : DBSIMPLE_SKIP, isset($subclass) ? $subclass : DBSIMPLE_SKIP, isset($type) ? $type : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
    $items = array();
    foreach ($rows as $row) {
        $items[] = iteminfo2($row);
    }
    save_cache(7, $cache_key, $items);
}
global $page;
开发者ID:Brueggus,项目名称:aowow,代码行数:31,代码来源:items.php

示例8: write_cache

function write_cache($file, $data)
{
    return file_put_contents('cache/' . cache_key($file), serialize($data));
}
开发者ID:najomi,项目名称:najomi.org,代码行数:4,代码来源:global.php

示例9: extract_values

<?php

// Необходима функция questinfo
require_once 'includes/allquests.php';
$smarty->config_load($conf_file, 'quest');
// Разделяем из запроса класс и подкласс квестов
@(list($Type, $ZoneOrSort) = extract_values($podrazdel));
$cache_key = cache_key($Type, $ZoneOrSort);
if (!($quests = load_cache(QUEST_LISTING, $cache_key))) {
    unset($quests);
    $rows = $DB->select("\n\t\tSELECT q.?#\n\t\t{\n\t\t\t, l.Title_loc?d AS Title_loc\n\t\t}\n\t\tFROM quest_template q\n\t\t{ LEFT JOIN (locales_quest l) ON l.entry=q.entry AND ? }\n\t\tWHERE\n\t\t\t1 = 1\n\t\t\t{ AND ZoneOrSort = ? }\n\t\t\t{ AND ZoneOrSort IN (?a) }\n\t\t\tAND q.Title NOT IN ('','----','?????')\n\t\t\tAND q.Title NOT LIKE '<DEPRECATED>%'\n\t\t\tAND q.Title NOT LIKE '<NYI>%'\n\t\t\tAND q.Title NOT LIKE '<nyi>%'\n\t\t\tAND q.Title NOT LIKE '<TEST>%'\n\t\t\tAND q.Title NOT LIKE '<TXT>%'\n\t\t\tAND q.Title NOT LIKE '<UNUSED%'\n\t\tORDER BY Title\n\t\t{LIMIT ?d}\n\t\t", $quest_cols[2], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, isset($ZoneOrSort) ? $ZoneOrSort : DBSIMPLE_SKIP, !isset($ZoneOrSort) && isset($Type) ? $quest_class[$Type] : DBSIMPLE_SKIP, $AoWoWconf['limit'] > 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
    $quests = array();
    foreach ($rows as $row) {
        $quests[] = GetQuestInfo($row, QUEST_DATAFLAG_LISTINGS);
    }
    save_cache(QUEST_LISTING, $cache_key, $quests);
}
if (!($quests_tot = load_cache(QUEST_TOT, 'quest_tot'))) {
    unset($quests_tot);
    $quests_tot = $DB->select("\n\t\tSELECT COUNT(q.entry) as quest_tot\n\t\tFROM quest_template q\n\t\tWHERE\n\t\t\tq.Title NOT IN ('','----','?????')\n\t\t\tAND q.Title NOT LIKE '<DEPRECATED>%'\n\t\t\tAND q.Title NOT LIKE '<NYI>%'\n\t\t\tAND q.Title NOT LIKE '<nyi>%'\n\t\t\tAND q.Title NOT LIKE '<TEST>%'\n\t\t\tAND q.Title NOT LIKE '<TXT>%'\n\t\t\tAND q.Title NOT LIKE '<UNUSED%'\n\t\t");
    save_cache(QUEST_LISTING, 'quest_tot', $quests_tot[0]['quest_tot']);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => path(0, 3, $Type, $ZoneOrSort));
$smarty->assign('page', $page);
$smarty->assign('quests', $quests);
$smarty->assign('quests_tot', is_array($quests_tot) ? $quests_tot[0]['quest_tot'] : $quests_tot);
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('quests.tpl');
开发者ID:Kheros,项目名称:tc_aowow,代码行数:31,代码来源:quests.php

示例10: extract_values

<?php

require_once 'includes/allspells.php';
require_once 'includes/allreputation.php';
$smarty->config_load($conf_file, 'spell');
@(list($s1, $s2, $s3) = extract_values($podrazdel));
$cache_key = cache_key($s1, $s2, $s3);
if (!($spells = load_cache(SPELL_LISTING, $cache_key))) {
    unset($spells);
    $spells = array();
    if ($s1 == 7) {
        // Классовые
        $title = $smarty->get_config_vars('Class_spells');
        $rows = $DB->select('
				SELECT ?#, s.`spellID`, sla.skillID
				FROM ?_spell s, ?_skill_line_ability sla, ?_spellicons i
				WHERE
					s.spellID = sla.spellID
					AND s.levelspell > 0
					AND i.id=s.spellicon
					{AND sla.classmask & ?d}
					{AND sla.skillID=?d}
				ORDER BY s.levelspell
				{LIMIT ?d}
			', $spell_cols[2], isset($s2) ? pow(2, $s2 - 1) : DBSIMPLE_SKIP, isset($s3) ? $s3 : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
    } elseif ($s1 > 0) {
        switch ($s1) {
            case 6:
                $title = $smarty->get_config_vars('Weapon_spells');
                break;
            case 8:
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:31,代码来源:spells.php

示例11: str_replace

require_once 'includes/allitems.php';
require_once 'includes/allnpcs.php';
require_once 'includes/allobjects.php';
// Настраиваем Smarty ;)
$smarty->config_load($conf_file, 'search');
// Строка поиска:
$search = str_replace(array('[', ']'), array('', ''), urldecode($podrazdel));
$nsearch = '%' . $search . '%';
$smarty->assign('search', $search);
// Подключаемся к ДБ
global $DB;
global $allitems;
global $allspells;
global $npc_cols;
global $spell_cols;
$cache_key = cache_key(md5(strtolower($search)));
// Массив всего найденного
if (!($found = load_cache(SEARCH, $cache_key))) {
    unset($found);
    if (!empty($podrazdel)) {
        // Ищем вещи:
        if ($_SESSION['locale'] > 0) {
            $m = $DB->selectCol('
				SELECT entry
				FROM locales_item
				WHERE name_loc?d LIKE ?
				LIMIT ' . $AoWoWconf["limit"] . '
			', $_SESSION['locale'], $nsearch);
        }
        $rows = $DB->select('
			SELECT i.?#
开发者ID:wow4all,项目名称:OpenRepack,代码行数:31,代码来源:search.php

示例12: compile_less

 public function compile_less()
 {
     require_once 'libs/lessc.inc.php';
     $this->less_complied = '';
     $content = '';
     $id = '';
     foreach ($this->less as $file) {
         $id .= $file . filesize($file);
     }
     $id = md5($id) . '_' . cache_key();
     $path = UPLOAD_PATH . '/css/' . $id . '.css';
     if (!file_exists($path)) {
         $this->lessc = new lessc();
         foreach ($this->less as $file) {
             $content .= $this->lessc->compileFile($file);
             //$this->less_complied .= "\t" . '<link rel="stylesheet/less" type="text/css" href="' . $file . '">' . "\n";
         }
         //$id = md5($content);
         file_put_contents($path, $content);
     }
     $this->css[] = get_url('/' . $path);
 }
开发者ID:nodefortytwo,项目名称:areyouhappy,代码行数:22,代码来源:template.class.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $cacheKey = cache_key("articles.show.{$id}");
     $secondKey = cache_key("articles.show.{$id}.comments");
     $query = Article::with('comments', 'tags', 'attachments', 'solution')->findOrFail($id);
     $article = $this->cache($cacheKey, 5, $query, 'findOrFail', $id);
     $secondQuery = $article->comments()->with('replies')->withTrashed()->whereNull('parent_id')->latest();
     $commentsCollection = $this->cache($secondKey, 5, $secondQuery, 'get');
     if (!is_api_request()) {
         event(new ArticleConsumed($article));
     }
     return $this->respondItem($article, $commentsCollection, $cacheKey . $secondKey);
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:19,代码来源:ArticlesController.php

示例14: header

<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Request-Method: *');
header('Content-type: application/x-javascript; charset=utf-8');
//$memcached = new Memcached();
//$memcached->addServer('localhost', 11211);
$url = $_GET['url'] ? rawurldecode($_GET['url']) : 'default';
$host = $_GET['host'] ? $_GET['host'] : 'default';
$callback = isset($_GET['callback']) ? $_GET['callback'] : 'aviasales_run_widget';
$file_name = './files/url2place/' . basename($host) . '.json';
if (!is_file($file_name)) {
    die($callback . '(false)');
}
function cache_key($param)
{
    return md5($param);
}
$key = cache_key($file_name);
$url_places = false;
//$memcached->get($key);
if (!$url_places) {
    $url_places = json_decode(file_get_contents($file_name), true);
    //$memcached->set($key, $url_places);
}
$data_to_send = array_key_exists($url, $url_places) ? $url_places[$url] : $url_places['default'];
echo $callback . '(' . json_encode($data_to_send) . ');';
开发者ID:KosyanMedia,项目名称:custom_form,代码行数:27,代码来源:url2place.php


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