本文整理汇总了PHP中cache_save函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_save函数的具体用法?PHP cache_save怎么用?PHP cache_save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Получение списка из кеша
* @param $type
* @return array
*/
function getList($type)
{
$list = cache_get('acl_' . $type, true);
if ($list) {
return $list;
}
$list = $this->createList($type);
cache_save('acl_' . $type, $list, true);
return $list;
}
示例2: handleOnShutdown
public static function handleOnShutdown()
{
$request = self::_getRequest();
if (!$request->three_o_four_buffering_started) {
return;
}
$response = ob_get_clean();
if (http_response_code() != 200) {
ob_end_flush();
return;
}
$contentLength = strlen($response);
$etag = null;
if (isset($request->three_o_four_cache_response) && $request->three_o_four_cache_response == true) {
$key = self::_generateCacheKey($request);
$microtime = microtime();
//$etag = md5($key . $microtime);
$etag = self::_hash($response);
$cacheData = array('changed' => $microtime, 'etag' => $etag, 'contentLength' => $contentLength, 'content' => $response, 'headers' => apache_response_headers(), 'params' => array());
if (isset($request->three_o_four_cache_opts['store_params'])) {
foreach ($request->three_o_four_cache_opts['store_params'] as $k) {
if (isset($request->url_params[$k])) {
$cacheData['params'][$k] = $request->url_params[$k];
}
}
}
// Optimization for pages
cache_set($key, $cacheData);
cache_save();
} else {
if (isset($request->three_o_four_emit_etag) && $request->three_o_four_emit_etag == true) {
$etag = self::_hash($response);
}
}
self::_sendResponse($response, $contentLength, $etag);
}
示例3: open
/**
* open(host, port);
* @return: true if connection was successful, false otherwise
*/
function open($host, $port)
{
$conn_status = 1;
if (function_exists("cache_assign_key")) {
// checkig if we had a successful connection with the same server and the same port
// whithin the last GEKKO_REMOTE_TIMEOUT seconds
$key = cache_assign_key($host, $port);
if (($life = cache_check_life($key)) !== false && time() - $life < GEKKO_REMOTE_CONN_CACHE_LIFE) {
// if we had a successful connection we put a 1 in a cached file, this is for
// avoiding wasting time trying to connect to a specific server when it is not
// responding, we can check it later
cache_read($key, $conn_status);
}
}
// trying to connect if the last try was successful of if this is the first
if ($conn_status) {
$this->socket = @fsockopen($host, $port, $this->errno, $this->errstr, GEKKO_REMOTE_CONN_TIMEOUT);
}
// saving connection status
if (function_exists("cache_save") && $conn_status != $this->status()) {
cache_save($key, intval($this->status()));
}
return $conn_status ? $this->status() : false;
}
示例4: cache_check
<?
$cachetime = (60*12) * 60;
include "cache.php";
cache_check('fikirdegistirenmod');
?>
Çabuk fikir deðiþtirenler ve beðenmeyenler (Modlar diðer entryleri düzenleyebilmektedir):
<table border="0">
<?php
$sorgu = mysql_query("select updater,count(id) as sayi from mesajciklar group by updater order by sayi desc limit 10");
while ($oku = mysql_fetch_array($sorgu)) {
echo "\n <tr>\n <td>{$oku['updater']} - {$oku['sayi']}</td>\n </tr>\n ";
}
?>
</table>
<?
cache_save('fikirdegistirenmod');
?>
示例5: cache_check
<td></td>
<p>
<?php
echo "<table border='0'>";
$cachetime = 60 * 12 * 60;
include "cache.php";
cache_check('encokokunan');
$sorgu = mysql_query("select baslik, (hit) as sayi from konucuklar group by baslik order by sayi desc limit 10");
while ($oku = mysql_fetch_array($sorgu)) {
echo "\n <tr>\n <td><a href='{$oku['baslik']}.html' target=main>{$oku['baslik']}</a> - {$oku['sayi']} Okuma</td>\n </tr>\n ";
}
?>
<?
cache_save('encokokunan');
?>
</table>
示例6: Menu_show
//.........这里部分代码省略.........
}
if (is_array($b)) {
$align = isset($b['direction']) && $b['direction'] == 'vertical' ? 'Left' : 'Top';
$vals = $b;
} else {
$arr = explode('|', $b);
$b = $arr[0];
$vals = array();
if (count($arr) > 1) {
$d = split(',', $arr[1]);
} else {
$d = array();
}
foreach ($d as $e) {
$f = split('=', $e);
if (count($f) > 1) {
$vals[$f[0]] = $f[1];
} else {
$vals[$f[0]] = 1;
}
}
$c = '';
$align = $b == 'vertical' ? 'Left' : 'Top';
}
$parent = 0;
$classes = '';
if (isset($vals['mode'])) {
if ($vals['mode'] == 'accordian' || $vals['mode'] == 'accordion') {
$classes .= ' click_required accordion';
} else {
if ($vals['mode'] == 'two-tier') {
$classes .= ' two-tier';
}
}
} else {
$vals['mode'] = 'default';
}
if (isset($vals['preopen_menu'])) {
$classes .= ' preopen_menu';
}
if (isset($vals['close']) && $vals['close'] == 'no') {
$classes .= ' noclose';
}
if (isset($vals['parent'])) {
$r = Page::getInstanceByName($vals['parent']);
if ($r) {
$parent = $r->id;
}
}
if (isset($vals['spans'])) {
$vals['spans'] = (int) $vals['spans'];
} else {
$vals['spans'] = 1;
}
$search_options = 0;
$ajaxmenu = $vals['nodropdowns'] ? '' : ' ajaxmenu ';
$c = '<div id="ajaxmenu' . $parent . '" class="menuBar' . $align . $ajaxmenu . $classes . ' parent' . $parent . '">';
$rs = Menu_getChildren($parent, $PAGEDATA->id, 0, $parent, $search_options);
$links = 0;
if ($vals['spans']) {
$spanl = '<span class="l"></span>';
$spanr = '<span class="r"></span>';
} else {
$spanl = '';
$spanr = '';
}
if (count($rs)) {
foreach ($rs as $r) {
$page = Page::getInstance($r['id']);
if (!$links) {
$r['classes'] .= ' first';
}
$c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars($page->name) . $spanr . '</a>';
$links++;
}
}
if (!@$GLOBALS['DBVARS']['disable-hidden-sitemap']) {
$c .= '<a class="menuItemTop nojs" href="' . $PAGEDATA->getRelativeURL() . '?webmespecial=sitemap">' . __('Site Map') . '</a>';
}
$c .= '</div>';
if ($vals['mode'] == 'two-tier') {
$pid = $PAGEDATA->getTopParentId();
if ($pid != 2 && $pid != 3 && $pid != 17 && $pid != 32 && $pid != 33 && $pid != 34) {
$pid = 2;
}
$rs = Menu_getChildren($pid, $PAGEDATA->id, 0, $parent, $search_options);
$c .= '<div id="ajaxmenu' . $pid . '" class="menu tier-two">';
if (count($rs)) {
foreach ($rs as $r) {
$page = Page::getInstance($r['id']);
$c .= '<a id="ajaxmenu_link' . $r['id'] . '" class="' . $r['classes'] . '" href="' . $page->getRelativeURL() . '">' . $spanl . htmlspecialchars($page->name) . $spanr . '</a>';
}
} else {
$c .= '<a><span class="l"></span> <span class="r"></span></a>';
}
$c .= '</div>';
}
cache_save('menus', $md5, $c);
return $c;
}
示例7: cache_check
<td>En Fazla + (hos) Oy'a Sahip Yazarlar:</td>
<p>
<?php
echo "<table border='0'>";
$cachetime = 60 * 12 * 60;
include "cache.php";
cache_check('enfazlahos');
$sorgu = mysql_query("select entry_sahibi,count(id) as sayi from oylar where oy='1' group by entry_sahibi order by sayi desc limit 10");
while ($oku = mysql_fetch_array($sorgu)) {
echo "\n <tr>\n <td><a href='sozluk.php?process=word&q={$oku['entry_sahibi']}' target=main>{$oku['entry_sahibi']}</a> : {$oku['sayi']} oy</td>\n </tr>\n ";
}
echo "</table>";
?>
<?
cache_save('enfazlhos');
?>
示例8: cache_check
<?
$cachetime = (5*60) * 1;
include "cache.php";
cache_check('duyuru');
?>
Duyduk duymadýk demeyenler:
<br>
<table border="0">
<?php
$sorgu = mysql_query("select yazar,count(id) as sayi from haberler group by yazar order by sayi desc limit 10");
while ($oku = mysql_fetch_array($sorgu)) {
echo "\n <tr>\n <td>{$oku['yazar']} - {$oku['sayi']}</td>\n </tr>\n ";
}
?>
</table>
<?
cache_save('duyuru');
?>
示例9: cache_check
<?
$cachetime = (30*60) * 1;
include "cache.php";
cache_check('bugungelenler');
?>
<td>Bugün bu bataga düþenler</td>
<p>
<table border="0" width="100%">
<?php
$today = date("Y/m/d");
$sorgu = mysql_query("select nick from user where regtarih='{$today}%' group by nick desc limit 10");
while ($oku = mysql_fetch_array($sorgu)) {
echo "<tr>\n <td><a href='sozluk.php?process=word&q={$oku['nick']}' tarhet=main>{$oku['nick']}</a></td>\n <td>";
}
?>
<?
cache_save('bugungelenler');
?>
示例10: cache_check
include "cache.php";
cache_check('yazarayx');
?>
<table border="0" width="60%">
<?
$sorgu=mysql_query("select entry_sahibi,count(id) as sayi from oylar where oy='1' group by entry_sahibi order by sayý desc limit 0,10");
$toplam=mysql_num_rows(mysql_query("select entry_sahibi from oylar "));
?>
<tr>
<td nowrap>toplam</td><td nowrap width="100%"><div class=highlight style='text-align:right; width:100%'><?php
echo $toplam;
?>
</td>
</tr>
<?
$say=0;
while ($oku=mysql_fetch_array($sorgu)) {
$say++;
$oran=$toplam/$oku['sayi'];
$yoran=100/$oran;
$kes=substr($yoran,0,1);
echo "<tr>
<td nowrap>$say. <a href='sozluk.php?process=word&q=$oku[entry_sahibi]' target=main>$oku[entry_sahibi]</a></td><td nowrap width='100%'><div class=highlight style='text-align:right; width:$kes%'>$oku[sayi]</td>
<td>";
}
?>
</table>
<?
cache_save('yazarayx');
?>
示例11: forum_latest_posts_cache
function forum_latest_posts_cache($options = array())
{
$posts = discussion_forum_post_fetch(array('threads_only' => 'true', 'limit' => 10, 'url_lookup' => true, 'order-by' => 'p.last_post', 'order-direction' => 'DESC', 'min_quality_level' => 2, 'max_userlevel_read' => 1));
cache_save('latest_forum_posts', $posts);
}
示例12: cache_check
<?
$cachetime = (10*60) * 1;
include "cache.php";
cache_check('saatista');
?>
<td width="100%">hangi saatlerde entry girilmiþ:</td><p>
<table border="0" width="100%">
<?
$sorgu=mysql_query("select saat,count(id) as sayi from mesajlar group by saat order by sayi desc limit 0,10");
$toplam=mysql_num_rows(mysql_query("select id from user"));
?>
<?
$say=0;
while ($oku=mysql_fetch_array($sorgu)) {
$say++;
$oran=$toplam/$oku['sayi'];
$yoran=100/$oran;
echo "<tr>
<td>$say. <a href='sozluk.php?process=word&q=$oku[saat]' target=main>$oku[saat]</a>($oku[sayi])</td>
<td>";
}
?>
</table>
<?
cache_save('saatista');
?>
示例13: mysql_query
<?php
$query = 'SELECT id, type, label, timestamp, url FROM recent_updates WHERE timestamp > ' . (time() - 900) . ' ORDER BY id DESC LIMIT 1';
$result = mysql_query($query);
if (mysql_num_rows($result) == 1) {
$data = mysql_fetch_assoc($result);
cache_save('recent_update', $data);
}
示例14: setting
imagesavealpha($imgThumb, true); // save alphablending setting (important)
}
// Copy ImageSrc to ImageThumb
if ($thLowquality) { $image_isCopied = imagecopyresized ( $imgThumb, $imgSrc, 0, 0, $offset_left, $offset_top, $imgnWidth, $imgnHeight, $imgoWidth, $imgoHeight ); }
if (!$thLowquality) { $image_isCopied = imagecopyresampled ( $imgThumb, $imgSrc, 0, 0, $offset_left, $offset_top, $imgnWidth, $imgnHeight, $imgoWidth, $imgoHeight ); }
$str = "imagecopyresized ( imgThumb, imgSrc, 0, 0, $offset_left, $offset_top, $imgnWidth, $imgnHeight, $imgoWidth, $imgoHeight );";
//error($str);
if (!$image_isCopied) { error("ImageCopy() Failed!\n$php_errormsg"); }
// Save Cache
if ($cfg["cacheEnabled"]) {
$imgCache = cache_save($realImgFile, $imgThumb, $thWidth, $thHeight);
}
// Header
header("Content-Disposition: filename=\"{$imgName}\"");
// Output Thumb
switch(strtolower($imgSrcExtension)) {
case "jpg": case "jpeg":
header("Content-type: image/jpeg");
imagejpeg($imgThumb, NULL, $thQuality);
if ($imgCache) { imagejpeg($imgThumb, $imgCache, $thQuality); }
break;
示例15: foreach
foreach ($files as $f) {
$mt = is_array($f) ? filemtime($f[0]) : filemtime($f);
if ($mt > $latest) {
$latest = $mt;
}
}
$name = md5($name);
if (file_exists(USERBASE . '/ww.cache/c/css-' . $name) && filemtime(USERBASE . '/ww.cache/c/css-' . $name) < $latest) {
unlink(USERBASE . '/ww.cache/c/css-' . $name);
}
$css_code = false;
//cache_load('c','css-'.$name);
if ($css_code == false) {
$css_code = '';
require 'Minify/CSS.php';
foreach ($files as $f) {
if (is_array($f)) {
$css_code .= Minify_CSS::minify(file_get_contents($f[0]), array('prependRelativePath' => preg_replace('/[^\\/]*$/', '', $f[1])));
} else {
$css_code .= Minify_CSS::minify(file_get_contents($f));
}
}
cache_save('c', 'css-' . $name, $css_code);
}
header('Content-type: text/css; charset=utf-8');
header('Cache-Control: max-age = 2592000');
header('Expires-Active: On');
header('Expires: Fri, 1 Jan 2500 01:01:01 GMT');
header('Pragma:');
header('Content-Length: ' . strlen($css_code));
echo $css_code;