本文整理汇总了PHP中cachemgr类的典型用法代码示例。如果您正苦于以下问题:PHP cachemgr类的具体用法?PHP cachemgr怎么用?PHP cachemgr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cachemgr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtoupper
function &select($sql)
{
if ($this->_rw_lnk) {
$db_lnk =& $this->_rw_lnk;
} else {
if ($this->_ro_lnk) {
$db_lnk =& $this->_ro_lnk;
} else {
$db_lnk =& $this->_ro_conn();
}
}
if (cachemgr::check_current_co_depth() > 0 && preg_match('/FROM\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $matchs)) {
if (isset($matchs[1])) {
$table = strtoupper(trim(str_replace(array('`', '"', '\''), array('', '', ''), $matchs[1])));
if (!cachemgr::check_current_co_objects_exists('DB', $table)) {
cachemgr::check_expries('DB', $table);
}
}
}
$rs = $this->exec($sql, false, $db_lnk);
$data = array();
while ($row = mysql_fetch_assoc($rs['rs'])) {
$data[] = $row;
}
mysql_free_result($rs['rs']);
return $data;
}
示例2: show
function show($gid, &$aGoods = null)
{
$render = $this->app->render();
if (!$aGoods) {
$o = kernel::single('b2c_goods_model');
$aGoods = $o->getGoods($gid);
}
if (!$aGoods['images']) {
$render->pagedata['noimage'] = 'true';
$imageDefault = app::get('image')->getConf('image.set');
$aGoods['images'][]['image_id'] = $imageDefault['M']['default_image'];
$aGoods['goods']['image_default_id'] = $imageDefault['M']['default_image'];
} else {
$oImage = app::get('image')->model('image');
$imageDefault = app::get('image')->getConf('image.set');
foreach ($aGoods['images'] as $k => $v) {
//todo 暂时cache 处理,以后优化的时候在storager中判断
//判断是否对应的图片是否存在,不存在则用默认图片显示
if (!cachemgr::get('goods_image' . intval($v['image_id']), $image_id)) {
cachemgr::co_start();
$image_id = $oImage->getList("image_id", array('image_id' => $v['image_id']));
cachemgr::set('goods_image' . intval($v['image_id']), $image_id, cachemgr::co_end());
}
if (!$image_id) {
if ($aGoods['image_default_id'] == $v['image_id']) {
$aGoods['image_default_id'] = $imageDefault['M']['default_image'];
}
$aGoods['images'][$k]['image_id'] = $imageDefault['M']['default_image'];
}
}
}
$render->pagedata['goods'] = $aGoods;
return $render->fetch('site/product/goodspic.html');
}
示例3: display_admin_widget
public function display_admin_widget($tpl, $fetch = false, $widgets_app)
{
$this->_vars = $this->pagedata;
$tmpl_file = realpath($tpl);
$cur_theme = kernel::single('site_theme_base')->get_default();
if ($tmpl_file || ECAE_MODE) {
$last_modified = filemtime($tmpl_file);
$compile_id = $this->compile_id($cur_theme . $tpl);
if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
$file_content = kernel::single('site_theme_tmpl_file')->get_widgets_content($cur_theme, $tpl, $widgets_app);
$compile_code = $this->_compiler()->compile($file_content);
if ($compile_code !== false) {
base_kvstore::instance('cache/theme_admin_widget')->store($compile_id, $compile_code);
}
}
ob_start();
eval('?>' . $compile_code);
$content = ob_get_contents();
ob_end_clean();
$this->pre_display($content);
} else {
$obj = kernel::single('base_render');
$obj->pagedata['tpl'] = $tpl;
$content = $obj->fetch('admin/theme/widgets_tpl_lost.html', 'site');
//todo: 无模板提示
}
if ($fetch === true) {
return $content;
} else {
echo $content;
}
}
示例4: display_admin_widget
public function display_admin_widget($tpl, $fetch = false, $widgets_app)
{
$this->_vars = $this->pagedata;
$tmpl_file = realpath($tpl);
$cur_theme = kernel::single('wap_theme_base')->get_default();
if ($tmpl_file || ECAE_MODE) {
$last_modified = filemtime($tmpl_file);
$compile_id = $this->compile_id($cur_theme . $tpl);
if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
$file_content = kernel::single('wap_theme_file')->get_widgets_content($cur_theme, $tpl, $widgets_app);
$compile_code = $this->_compiler()->compile($file_content);
if ($compile_code !== false) {
base_kvstore::instance('cache/theme_admin_widget')->store($compile_id, $compile_code);
}
}
ob_start();
eval('?>' . $compile_code);
$content = ob_get_contents();
ob_end_clean();
$this->pre_display($content);
} else {
$obj = kernel::single('base_render');
$content = "<p class='notice' style='margin:0.3em'>{$tpl}<strong><{t app='wap'}>模板不存在,请重新编辑<{/t}></strong></p>";
}
if ($fetch === true) {
return $content;
} else {
echo $content;
}
}
示例5: result
function result()
{
$oSearch =& $this->app->model('search');
$emu_static = $this->app->getConf('system.seo.emuStatic');
$cat_id = $_POST['cat_id'];
unset($_POST['cat_id']);
foreach ($_POST as $k => $v) {
if ($k == "name" && $_POST[$k][0]) {
$_POST[$k][0] = str_replace('_', '%xia%', $_POST[$k][0]);
}
if ($k == "price" && $_POST[$k][1]) {
$_POST[$k][0] = floatval($_POST[$k][0]);
$_POST[$k][1] = floatval($_POST[$k][1]);
}
}
if (isset($_POST['filter']) && ($filter = $oSearch->decode($_POST['filter'], $path))) {
$filter = array_merge($filter, $_POST);
} else {
$filter = $_POST;
}
unset($_POST['filter']);
$filter = $oSearch->encode($filter);
if (empty($cat_id) && empty($filter)) {
$args = null;
} else {
$args = array($cat_id, $filter);
}
cachemgr::clean($msg);
$this->sredirect(array('app' => 'b2c', 'ctl' => 'site_gallery', 'act' => 'index', 'args' => $args));
}
示例6: theme_widget_articles
/**
* ShopEx licence
*
* @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
* @license http://ecos.shopex.cn/ ShopEx License
*/
function theme_widget_articles(&$setting, &$smarty)
{
$setting['order'] or $setting['order'] = 'desc';
$setting['order_type'] or $setting['order_type'] = 'pubtime';
$func = array('asc' => 'ksort', 'desc' => 'krsort');
$mdl_memberLv = app::get('b2c')->model('member_lv');
$default_member_lv = $mdl_memberLv->dump(array('default_lv' => '1'), 'member_lv_id');
$member_level = $default_member_lv['member_lv_id'];
//默认等级
$obj_members = app::get('b2c')->model('members');
$memberTmp = $obj_members->get_current_member();
$member_type = '1';
if (isset($memberTmp['member_lv'])) {
$member_level = $memberTmp['member_lv'];
$member_type = $memberTmp['member_type'];
}
//$member_type = '2';
$oAN = kernel::single("content_article_node");
$oMAI = app::get('content')->model('article_indexs');
$objrequest = kernel::single("base_component_request");
$article_id = $objrequest->get_param(0);
if (isset($setting['upto_articleid']) && $setting['upto_articleid'] == "1" && $article_id > 0) {
//获取父节点id
$nodeinfo = $oMAI->getList("node_id", array("article_id" => $article_id));
$iNodeId = $nodeinfo[0]['node_id'];
}
if (!$iNodeId) {
$iNodeId = $setting['node_id'];
}
$lv = $setting['lv'];
$limit = $setting['limit'];
$tmp = $oAN->get_node($iNodeId, false, $member_type);
article_foost($lv, $iNodeId, $limit, $setting['showallart'], $oAN, $oMAI, $tmp['child'], $setting, $member_type);
//error_log(var_export($tmp,true),3,DATA_DIR.'/pansen.dd.txt');
$html = array();
article_showst($smarty, $tmp['child'], $setting, $html, 0, $limit);
if (!$setting['shownode']) {
$func[$setting['order']]($html);
}
$html = implode(' ', $html);
$filter = array();
$filter['ifpub'] = 'true';
$filter['pubtime|than'] = time();
$arr = $oMAI->getList('pubtime', $filter, 0, 1, ' pubtime ASC');
if ($arr) {
//设置缓存过期时间
reset($arr);
$arr = current($arr);
cachemgr::set_expiration($arr['pubtime']);
}
$tmp['__html'] = $html;
$tmp['__shownode'] = $setting['shownode'];
$tmp['__stripparenturl'] = $setting['stripparenturl'];
if ($tmp['homepage'] == 'true') {
$tmp['node_url'] = app::get('site')->router()->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'nodeindex', 'arg0' => $setting['node_id']));
} else {
$tmp['node_url'] = app::get('site')->router()->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'lists', 'arg0' => $setting['node_id']));
}
return $tmp;
}
示例7: cachedir
function cachedir()
{
$system =& $GLOBALS['system'];
$this->db =& $system->database();
$this->totalBytes = 15 << 20;
$row = $this->db->selectrow('select sum(cache_size) as size from sdb_cachedir');
if (false === $row) {
$this->db->exec('drop table if exists sdb_cachedir', 1, 1);
$sql = <<<EOF
create table sdb_cachedir
(
cache_file varchar(32) not null,
cache_size mediumint unsigned not null,
last_update int unsigned not null,
primary key (cache_file)
)type = MyISAM
EOF;
$this->db->exec($sql, 1, 1);
} else {
$this->curBytes = $row['size'];
if ($row['size'] > $this->totalBytes) {
$this->_free(10, $row['size'] - $this->totalBytes);
}
}
parent::cachemgr();
}
示例8: _get_goods
function _get_goods($gid)
{
$render = $this->app->render();
$objGoods = $this->app->model('goods');
$aGoods_list = $objGoods->getList("goods_id,name,bn,brief,brand_id,type_id,unit,params,p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20,p_21,p_22,p_23,p_24,p_25,p_26,p_27,p_28,p_29,p_30,p_31,p_32,p_33,p_34,p_35,p_36,p_37,p_38,p_39,p_40,p_41,p_42,p_43,p_44,p_45,p_46,p_47,p_48,p_49,p_50", array('goods_id' => $gid));
$aGoods['name'] = $aGoods_list[0]['name'];
$aGoods['bn'] = $aGoods_list[0]['bn'];
$aGoods['brief'] = $aGoods_list[0]['brief'];
$aGoods['params'] = $aGoods_list[0]['params'];
$goods_type = app::get("b2c")->model("goods_type");
cachemgr::co_start();
if (!cachemgr::get("goods_type_props_value_list2dump" . $aGoods_list[0]['type_id'], $goods_type_data)) {
$goods_type_data = $goods_type->dump($aGoods_list[0]['type_id']);
cachemgr::set("goods_type_props_value_list2dump" . $aGoods_list[0]['type_id'], $goods_type_data, cachemgr::co_end());
}
$aGoods['type'] = $goods_type_data;
$brand_row = $goods_type->db->selectrow("select brand_id,brand_name from sdb_b2c_brand where brand_id=" . intval($aGoods_list[0]['brand_id']));
$aGoods['brand'] = $brand_row;
foreach ($aGoods_list[0] as $aGoods_k => $aGoods_v) {
if (strpos($aGoods_k, "p_") === 0) {
$aGoods['props'][$aGoods_k]['value'] = $aGoods_v;
}
}
return $aGoods;
}
示例9: check_vary_list
protected function check_vary_list()
{
if (!isset($this->_vary_list)) {
$this->_vary_list = cachemgr::fetch_vary_list();
if (empty($this->_vary_list)) {
$this->_vary_list = cachemgr::fetch_vary_list(true);
}
}
}
示例10: clean
public function clean()
{
$this->pagedata['clean'] = 'current';
$this->index();
if (cachemgr::clean($msg)) {
echo '<p class="notice">' . ($msg ? $msg : '清空缓存完成') . '</p>';
} else {
echo '<p class="notice">' . ($msg ? $msg : '清空缓存失败') . '</p>';
}
}
示例11: getCacheInfo
public function getCacheInfo()
{
if (!defined("CACHE_STORAGE")) {
return false;
}
$aTmp = explode("_", CACHE_STORAGE);
$msg = false;
cachemgr::status($msg);
$aResult = array("name" => $aTmp[count($aTmp) - 1], "status" => $msg);
return $aResult;
}
示例12: __construct
function __construct()
{
if (!kernel::is_online()) {
die('error');
} else {
require ROOT_DIR . '/config/config.php';
@(include APP_DIR . '/base/defined.php');
}
cachemgr::init();
cacheobject::init();
}
示例13: __construct
function __construct()
{
if (!kernel::is_online()) {
die('error');
} else {
@(include APP_DIR . '/base/defined.php');
}
cachemgr::init();
cacheobject::init();
self::$is_start = true;
}
示例14: memcached
function memcached()
{
if (!class_exists('Memcache')) {
trigger_error('Missing php_memcache module', E_USER_ERROR);
}
$this->obj = new Memcache();
if (!$this->obj->connect(MEMCACHED_HOST, MEMCACHED_PORT)) {
trigger_error('Can\'t connect memcached server', E_USER_ERROR);
}
parent::cachemgr();
}
示例15: display
function display($tmpl_file, $app_id = null, $fetch = false, $is_theme = false)
{
array_unshift($this->_files, $tmpl_file);
$this->_vars = $this->pagedata;
if ($p = strpos($tmpl_file, ':')) {
$object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
if ($object) {
$tmpl_file_path = substr($tmpl_file, $p + 1);
$last_modified = $object->last_modified($tmpl_file_path);
}
} else {
if (defined('CUSTOM_CORE_DIR') && file_exists(CUSTOM_CORE_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file)) {
$tmpl_file = CUSTOM_CORE_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file;
} else {
if (!$is_theme) {
$tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
} else {
$tmpl_file = realpath(THEME_DIR . '/' . $tmpl_file);
}
}
$last_modified = filemtime($tmpl_file);
}
if (!$last_modified) {
//无文件
}
$this->tmpl_cachekey('__temp_lang', kernel::get_lang());
//设置模版所属语言包
$this->tmpl_cachekey('__temp_app_id', $app_id ? $app_id : $this->app->app_id);
$compile_id = $this->compile_id($tmpl_file);
#if($this->force_compile || base_kvstore::instance('cache/template')->fetch($compile_id, $compile_code, $last_modified) === false){
if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
if ($object) {
$compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
} else {
$compile_code = $this->_compiler()->compile_file($tmpl_file);
}
if ($compile_code !== false) {
#base_kvstore::instance('cache/template')->store($compile_id,$compile_code);
cachemgr::co_start();
cachemgr::set($compile_id . $last_modified, $compile_code, cachemgr::co_end());
}
}
ob_start();
eval('?>' . $compile_code);
$content = ob_get_contents();
ob_end_clean();
array_shift($this->_files);
$this->pre_display($content);
if ($fetch === true) {
return $content;
} else {
echo $content;
}
}