本文整理汇总了PHP中write_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP write_cache函数的具体用法?PHP write_cache怎么用?PHP write_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_function_qishi_get_salary_data_salary_pie
function tpl_function_qishi_get_salary_data_salary_pie($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "调用名称":
$aset['alias'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
case "地区":
$aset['district'] = $a[1];
break;
case "职位":
$aset['category'] = $a[1];
break;
}
}
$filename = urlencode($aset['district'] . '_' . $aset['category']) . '_salary_pie.cache';
$result = check_cache($filename, 'salary', 7);
if (!$result) {
$result = dfopen("http://www.74cms.com/salary/get_salary_data_salary_pie.php?district=" . $aset['district'] . "&category=" . $aset['category'] . "&certification=" . $_SERVER['SERVER_NAME']);
write_cache($filename, $result, 'salary');
}
$smarty->assign($aset['listname'], $result);
}
示例2: olc_cache_manufacturers_box
function olc_cache_manufacturers_box($auto_expire = false, $refresh = false)
{
if ($refresh == true || !read_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id'], $auto_expire)) {
ob_start();
include box_code_script_path('manufacturers.php');
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id']);
}
return $cache_output;
}
示例3: olc_cache_also_purchased
function olc_cache_also_purchased($auto_expire = false, $refresh = false)
{
if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id'], $auto_expire)) {
ob_start();
include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS;
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id']);
}
return $cache_output;
}
示例4: olc_cache_categories_box
function olc_cache_categories_box($auto_expire = false, $refresh = false)
{
global $cPath, $foo, $id, $categories_string;
if ($refresh == true || !read_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath, $auto_expire)) {
ob_start();
include box_code_script_path('categories.php');
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath);
}
return $cache_output;
}
示例5: unyaml
function unyaml($file)
{
static $yaml = false;
if ($_SERVER['HTTP_HOST'] != 'localhost:8000') {
if (cache_exists($file)) {
return read_cache($file);
}
}
if (!$yaml) {
$yaml = new sfYamlParser();
}
$data = $yaml->parse(file_get_contents($file));
$data = fix_comments($data);
write_cache($file, $data);
return $data;
}
示例6: get_db_cache
function get_db_cache($sql, &$var, $filename, $refresh = false)
{
$var = array();
// check for the refresh flag and try to the data
if ($refresh == true || !read_cache($var, $filename)) {
// Didn' get cache so go to the database.
// $conn = mysql_connect("localhost", "apachecon", "apachecon");
$res = xtc_db_query($sql);
// if ($err = mysql_error()) trigger_error($err, E_USER_ERROR);
// loop through the results and add them to an array
while ($rec = xtc_db_fetch_array($res)) {
$var[] = $rec;
}
// write the data to the file
write_cache($var, $filename);
}
}
示例7: zen_cache_also_purchased
function zen_cache_also_purchased($auto_expire = false, $refresh = false)
{
if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id'], $auto_expire)) {
ob_start();
include DIR_WS_MODULES . zen_get_module_directory(FILENAME_ALSO_PURCHASED_PRODUCTS);
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id']);
}
return $cache_output;
}
示例8: mysql
require_once QISHI_ROOT_PATH . 'include/mysql.class.php';
require_once QISHI_ROOT_PATH . 'include/fun_personal.php';
$smarty->cache = false;
$db = new mysql($dbhost, $dbuser, $dbpass, $dbname);
$act = !empty($_REQUEST['act']) ? trim($_REQUEST['act']) : 'salary';
$smarty->cache = false;
$filename = urlencode($_GET['district'] . '_' . $_GET['category']) . '_all_salary.cache';
$result = check_cache($filename, 'salary', 7);
if (!$result) {
$result = dfopen("http://www.74cms.com/salary/get_salary_data_all_salary.php?district=" . $_GET['district'] . "&category=" . $_GET['category'] . "&certification=" . $_SERVER['SERVER_NAME']);
write_cache($filename, $result, 'salary');
}
if ($result != "-1") {
$result = json_decode($result, true);
} else {
$result = "error";
}
$str1 = $_GET['district'] != '' ? $_GET['district'] : '全国';
$str2 = $_GET['category'] != '' ? $_GET['category'] : '职工';
$str3 = $_GET['category'] != '' ? $_GET['category'] : '企业';
$smarty->assign('str', $str1 . $str2);
$smarty->assign('str2', $str1 . $str3);
$smarty->assign('all_salary', $result);
$filename = urlencode($_GET['district'] . '_' . $_GET['category']) . '_salary_barchart.cache';
$result = check_cache($filename, 'salary', 7);
if (!$result) {
$result = dfopen("http://www.74cms.com/salary/get_salary_data_salary_barchart.php?district=" . $_GET['district'] . "&category=" . $_GET['category'] . "&certification=" . $_SERVER['SERVER_NAME']);
write_cache($filename, $result, 'salary');
}
$smarty->assign('salary_barchart_experience', $result);
$smarty->display("m/m-salary.html");
示例9: tep_cache_also_purchased
function tep_cache_also_purchased($auto_expire = false, $refresh = false)
{
global $_GET, $language, $languages_id;
$cache_output = '';
if (isset($_GET['products_id']) && is_numeric($_GET['products_id'])) {
if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id'], $auto_expire)) {
ob_start();
include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS;
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id']);
}
}
return $cache_output;
}
示例10: tep_cache_categories_superfish_box
function tep_cache_categories_superfish_box($auto_expire = false, $refresh = false)
{
global $cPath, $language;
$cache_output = '';
if ($refresh == true || !read_cache($cache_output, 'categories_superfish_box-' . $language . '.cache' . $cPath, $auto_expire)) {
if (!class_exists('bm_categories_superfish')) {
include DIR_WS_MODULES . 'boxes/bm_categories_superfish.php';
}
$bm_categories_superfish = new bm_categories_superfish();
$cache_output = $bm_categories_superfish->getData();
write_cache($cache_output, 'categories_superfish_box-' . $language . '.cache' . $cPath);
}
return $cache_output;
}
示例11: tep_cache_authors_box
function tep_cache_authors_box($auto_expire = false, $refresh = false)
{
global $_GET, $language;
$authors_id = '';
if (isset($_GET['authors_id']) && tep_not_null($_GET['authors_id'])) {
$authors_id = $_GET['authors_id'];
}
if ($refresh == true || !read_cache($cache_output, 'authors_box-' . $language . '.cache' . $authors_id, $auto_expire)) {
ob_start();
include DIR_WS_BOXES . 'authors.php';
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'authors_box-' . $language . '.cache' . $authors_id);
}
return $cache_output;
}
示例12: get_books
function get_books($version)
{
global $dbs_book_codes;
global $osis_book_codes;
global $is_cache_enabled;
global $clear_cache;
$cache_key = $version . '-info.json';
$result = null;
if ($is_cache_enabled && !$clear_cache) {
$result = read_cache($cache_key, true);
}
if ($result == null) {
/* copyright info */
$abs_version_data = get_abs_data('https://bibles.org/v2/versions/' . $version . '.js');
$abs_version = $abs_version_data->response->versions[0];
$aboutHtml = '<h1>' . $abs_version->name . ' (' . $abs_version->abbreviation . ')' . '</h1>' . '<dl>' . '<dt>Copyright</dt>' . '<dd>' . $abs_version->copyright . '</dd>' . '<dt>Info</dt>' . '<dd>' . ($text = preg_replace('/<h\\d>(.*)<\\/h\\d>/', '', $abs_version->info) . '</dd>' . '<dt>Source</dt>' . '<dd>This text comes from the <a href="https://bibles.org/pages/api/">BIBLESEARCH API</a> provided by <a href="http://www.americanbible.org/">American Bible Society</a></dd>' . '<dt>API EULA</dt>' . '<dd><a href="https://bibles.org/pages/legal#terms">End User License Agreement</a> for API</dd>' . '</dl>');
$abs_data = get_abs_data('https://bibles.org/v2/versions/' . $version . '/books.js');
if ($abs_data == null) {
return null;
}
$abs_books = $abs_data->response->books;
$divisions = array();
$divisionNames = array();
$divisionAbbreviations = array();
$sections = array();
//$chapters = array();
foreach ($abs_books as &$abs_book) {
$dbs_book_code = osis_code_to_dbs($abs_book->abbr);
if ($dbs_book_code != null) {
array_push($divisions, $dbs_book_code);
array_push($divisionNames, $abs_book->name);
array_push($divisionAbbreviations, $abs_book->abbr);
// find the last chapter
$osis_end = $abs_book->osis_end;
// "eng-AMP:Gen.50.26
$osis_end_parts = explode('.', $osis_end);
$last_chapter = $osis_end_parts[1];
//array_push($chapters, $last_chapter);
//array_push($sections, $osis_end); // sizeof($osis_end_parts)); // $dbs_book_code . strval($last_chapter));
// create sections
for ($c = 1; $c <= $last_chapter; $c++) {
array_push($sections, $dbs_book_code . strval($c));
}
}
}
$result = array(aboutHtml => $aboutHtml, divisions => $divisions, divisionNames => $divisionNames, divisionAbbreviations => $divisionAbbreviations, sections => $sections);
if ($is_cache_enabled) {
write_cache($cache_key, $result, true);
$is_from_cache = true;
}
}
$result["cache_key"] = ${$cache_key};
$result["is_from_cache"] = $is_from_cache;
return $result;
}
示例13: eve_crawl_url
function eve_crawl_url($url, $iteration)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
#pretend we're IE
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
if (strpos($page, "That kill doesn't exist.")) {
echo "ERROR: Kill Doesn't Exist.<br />\n";
write_cache($iteration);
return false;
}
$location_format = "#system_detail&sys_id=([0-9]+)\">([a-zA-Z0-9- ']+)</a></b>#";
preg_match($location_format, $page, $matches);
$location = $matches[2];
if (empty($location)) {
echo "ERROR: #{$iteration}, LOCATION.<br />\n";
write_cache($iteration);
return false;
}
$location_id = item_to_id($location, "wt_systems");
$date_format = "#<td class=kb-table-cell>([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})</td>#";
preg_match($date_format, $page, $matches);
$date = $matches[1];
if (empty($date)) {
echo "ERROR: #{$iteration}, DATE.<br />\n";
write_cache($iteration);
return false;
}
$loss_isk_format = "#<td class=kb-table-cell>([0-9,]+\\.[0-9]{2})</td>#";
preg_match($loss_isk_format, $page, $matches);
$loss_isk = round(ereg_replace("[^0-9.]", "", $matches[1]));
if (empty($loss_isk)) {
echo "ERROR: #{$iteration}, LOSS ISK. Continuing...<br />\n";
write_cache($iteration);
$loss_isk = 0;
}
$victim_format = '#<td class=kb-table-cell><b><a href="\\?a=pilot_detail&plt_id=([0-9]+)">([a-zA-Z0-9- \']+)</a></b></td>#';
preg_match($victim_format, $page, $matches);
$victim_name = $matches[2];
if (empty($victim_name)) {
echo "ERROR: #{$iteration}, VICTIM NAME.<br />\n";
write_cache($iteration);
return false;
}
$victim_id = item_to_id($victim_name, "wt_player");
$victim_corp_format = '#<td class=kb-table-cell><b><a href="\\?a=corp_detail&crp_id=([0-9]+)">([a-zA-Z0-9 \'\\-.]+)</a></b></td>#';
preg_match($victim_corp_format, $page, $matches);
$victim_corp_name = $matches[2];
if (empty($victim_corp_name)) {
echo "ERROR: #{$iteration}, VICTIM CORP NAME.<br />\n";
write_cache($iteration);
return false;
}
$victim_corp_id = item_to_id($victim_corp_name, "wt_corporation");
$victim_alliance_format = '#<b><a href="\\?a=alliance_detail&all_id=[0-9]+">([a-zA-Z0-9 \'\\-.]+)[</a>]*</b></td>#';
preg_match($victim_alliance_format, $page, $matches);
$victim_alliance_name = $matches[1];
if (empty($victim_alliance_name)) {
echo "ERROR: #{$iteration}, VICTIM ALLIANCE NAME.<br />\n";
write_cache($iteration);
return false;
}
$victim_alliance_id = item_to_id($victim_alliance_name, "wt_alliance");
$victim_ship_format = '#<td class=kb-table-cell><b><a href="\\?a=invtype&id=([0-9]+)">([a-zA-Z0-9 \'\\-.]+)</a></b></td>#';
preg_match($victim_ship_format, $page, $matches);
$victim_ship_name = $matches[2];
if (empty($victim_ship_name)) {
echo "ERROR: #{$iteration}, VICTIM SHIP NAME.<br />\n";
write_cache($iteration);
return false;
}
$victim_ship_id = item_to_id($victim_ship_name, "wt_ships");
$killer_name_format = '#<a href="\\?a=pilot_detail&plt_id=[0-9]+"><b>([0-9a-zA-Z \']+)[ \\(Final Blow\\)]*</b></a></td>#';
preg_match_all($killer_name_format, $page, $matches);
#print_r($matches[1]);
$killer_names = $matches[1];
$killer_corp_format = '#<a href="\\?a=corp_detail&crp_id=[0-9]+">([0-9a-zA-Z -.\']+)</a></td>#';
preg_match_all($killer_corp_format, $page, $matches);
#print_r($matches[1]);
$killer_corps = $matches[1];
$killer_ship_format = '#1px;"><b><a href="\\?a=invtype&id=[0-9]+">([0-9a-zA-Z ]+)</a></b></td>#';
preg_match_all($killer_ship_format, $page, $matches);
#print_r($matches[1]);
$killer_ships = $matches[1];
$killer_alliance_format = '#style="padding-top: 1px; padding-bottom: 1px;"><a href="\\?a=alliance_detail&all_id=[0-9]+">([0-9a-zA-Z-. \']+)</a></td>#';
preg_match_all($killer_alliance_format, $page, $matches);
#print_r($matches[1]);
$killer_alliances = $matches[1];
$size_killer_names = sizeof($killer_names);
$size_killer_corps = sizeof($killer_corps);
$size_killer_ships = sizeof($killer_ships);
$size_killer_alliances = sizeof($killer_alliances);
if ($size_killer_names != $size_killer_corps || $size_killer_ships != $size_killer_alliances || $size_killer_names != $size_killer_ships) {
echo "ERROR: #{$iteration}, KILLER ARRAY MISMATCH [n:{$size_killer_names}, c:{$size_killer_corps}, s:{$size_killer_ships}, a:{$size_killer_alliances}].<br />\n";
write_cache($iteration);
return false;
//.........这里部分代码省略.........
示例14: write_cache
write_cache('eep', $hash, $file);
} else {
// has cache
$file = $cache;
}
}
// make c file
if ($filetype == 'c') {
$filename = 'keymap.c';
$hash = sha1(serialize(array('matrix_rows' => $matrix_rows, 'matrix_cols' => $matrix_cols, 'max_layers' => $max_layers, 'max_fns' => $max_fns, 'keymaps' => $keymaps, 'fn_actions' => $fn_actions)));
// check cache
$cache = check_cache('c', $hash);
if (is_null($cache)) {
// no cache
$file = generate_c_file($matrix_rows, $matrix_cols, $max_layers, $max_fns, $keymaps, $fn_actions);
write_cache('c', $hash, $file);
} else {
// has cache
$file = $cache;
}
// prepend header
$header = generate_c_header();
$file = $header . $file;
}
// download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Length: ' . strlen($file));
echo $file;
//var_dump($keymaps);
exit;
示例15: tep_cache_product_finder
function tep_cache_product_finder($auto_expire = false, $refresh = false)
{
global $cPath, $_GET, $language, $languages_id, $cPath_array, $specification_group;
if ($refresh == true || !read_cache($cache_output, 'product_finder-' . $language . '.cache' . $cPath, $auto_expire)) {
ob_start();
include DIR_WS_MODULES . 'product_finder.php';
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'product_finder-' . $language . '.cache' . $cPath);
}
return $cache_output;
}