• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_cache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

 public function run()
 {
     $needs_alert = false;
     $data = get_from_cache('events', 'SessionStart');
     /* if the session didn't start we store the information; admin will
      * receive the alert only once. */
     if ($data == NULL) {
         $data = array();
     }
     $user = $this->ev->user->getAttribute('login');
     if (isset($data[$user]) && $this->ev->ok) {
         unset($data[$user]);
     }
     if (!isset($data[$user]) && !$this->ev->ok) {
         $needs_alert = true;
         $data[$user] = false;
     }
     set_cache($data, 'events', 'SessionStart');
     if ($needs_alert) {
         Logger::debug('main', 'SessionStartMail: sending alert');
         $subject = sprintf(_('OVD Session alert: %s couldn\'t log in'), $user);
         if (isset($this->ev->error)) {
             $message = _("The following error happened:\n") . $this->ev->error;
         } else {
             $message = _('No error given');
         }
         send_alert_mail($subject, $message);
     }
     return true;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:30,代码来源:Mail.class.php


示例2: run

 public function run()
 {
     Logger::debug('main', 'ServerStatusChangedTask::run');
     $needs_cleanup = false;
     $data = get_from_cache('events', 'ServerStatusChanged');
     if ($data == NULL) {
         $data[$this->ev->fqdn] = $this->ev->status;
         if ($this->ev->status != ServerStatusChanged::$ONLINE) {
             $needs_cleanup = true;
         }
     } else {
         if ($this->ev->status != ServerStatusChanged::$ONLINE) {
             $needs_cleanup = true;
         }
     }
     if ($needs_cleanup) {
         Logger::debug('main', 'ServerStatusChangedTask::run cleanup task for ' . $this->ev->fqdn);
         set_cache($data, 'events', 'ServerStatusChanged');
         $tm = new Tasks_Manager();
         $tm->load_from_server($this->ev->fqdn);
         foreach ($tm->tasks as $a_task) {
             $tm->remove($a_task->id);
         }
     }
     return true;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:26,代码来源:Task.class.php


示例3: cache_select

 public function cache_select()
 {
     $uid = $_SESSION['uid'];
     if (isset($GLOBALS['setcache'])) {
         $ids = get_cache('cache_all-' . $uid);
     } else {
         if (!isset($GLOBALS['ids']) || empty($GLOBALS['ids'])) {
             $where = array('keyid' => 'cache_all');
             $result = $this->db->get_list('setting', $where, '*', 0, 100);
             $ids = array();
             foreach ($result as $r) {
                 $ids[] = $r['id'];
             }
         } else {
             $ids = array_map('intval', $GLOBALS['ids']);
         }
         set_cache('cache_all-' . $uid, $ids);
     }
     if (empty($ids)) {
         MSG('缓存更新完成', '?m=core&f=cache_all&v=index' . $this->su(), 2000);
     }
     $id = array_shift($ids);
     $r = $this->db->get_one('setting', array('id' => $id));
     $caches = load_class($r['f'], $r['m']);
     if ($caches->{$r}['v']()) {
         set_cache('cache_all-' . $uid, $ids);
         MSG($r['data'] . L('update success'), '?m=core&f=cache_all&v=cache_select&setcache=1&' . $this->su(), 200);
     } else {
         MSG(L('operation failure'));
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:31,代码来源:cache_all.php


示例4: cache_all

 /**
  * 更新敏感词缓存,默认最多1万个敏感词
  * @return bool
  */
 public function cache_all()
 {
     $db = load_class('db');
     $result = $db->get_list('admin_role', '', '*', 0, 100, 0, '', '', 'role');
     set_cache('roles', $result);
     return true;
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:11,代码来源:cache_role.class.php


示例5: indexAction

 public function indexAction()
 {
     $action = $this->get('action');
     $size = $this->get('size');
     if ($this->post('submit')) {
         $size = 2048;
         //每个分卷文件大小
         $tables = $this->post('table');
         if (empty($tables)) {
             $this->show_message('您还没有选择要备份的表。');
         }
         set_cache('bakup_tables', array('tables' => $tables, 'time' => time()));
         $this->show_message('正在备份数据...', 1, url('database/index', array('action' => 1, 'size' => $size)), 100);
     }
     if ($action) {
         $fileid = $this->get('fileid');
         $random = $this->get('random');
         $tableid = $this->get('tableid');
         $startfrom = $this->get('startfrom');
         $this->export_database($size, $action, $fileid, $random, $tableid, $startfrom);
     } else {
         $dbname = $this->db->getdbName();
         $dbprefix = $this->db->getTablePrefix();
         $data = $this->db->query('SHOW TABLE STATUS FROM `' . $dbname . '`')->fetchAll();
         foreach ($data as $key => $t) {
             $data[$key]['xiaosys'] = substr($t['Name'], 0, strlen($dbprefix)) != $dbprefix ? 0 : 1;
         }
         include $this->admin_tpl('database_list');
     }
 }
开发者ID:43431655,项目名称:qizhongbao,代码行数:30,代码来源:database.php


示例6: run

 public function run()
 {
     $needs_alert = false;
     $data = get_from_cache('events', 'SqlFailure');
     if ($data == NULL) {
         $data[$this->ev->host] = $this->ev->status;
         if ($this->ev->status < 0) {
             $needs_alert = true;
         }
     } else {
         if (isset($data[$this->ev->host]) && $data[$this->ev->host] != $this->ev->status) {
             $data[$this->ev->host] = $this->ev->status;
             $needs_alert = true;
         }
     }
     if ($needs_alert) {
         set_cache($data, 'events', 'SqlFailure');
         Logger::debug('main', 'SqlFailureMail: sending alert');
         if ($this->ev->status < 0) {
             $subject = sprintf(_('OVD Alert: MySQL %s is offline'), $this->ev->host);
         } else {
             $subject = sprintf(_('OVD End Alert: MySQL %s is up again'), $this->ev->host);
         }
         send_alert_mail($subject, '');
     }
     return true;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:27,代码来源:Mail.class.php


示例7: listing

 /**
  * 列表
  */
 public function listing()
 {
     //0, $order = '', $group = '', $keyfield = ''
     $result = $this->db->get_list('site', '', '*', 0, 100, 0, '', '', 'siteid');
     set_cache('sitelist', $result);
     include $this->template('site_listing');
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:10,代码来源:site.php


示例8: track

function track($data)
{
    $cache_key = 'click_' . $data['h'] . '';
    if (MAD_TRACK_UNIQUE_CLICKS) {
        $cache_result = get_cache($cache_key);
        if ($cache_result && $cache_result == 1) {
            return false;
        } else {
            set_cache($cache_key, 1, 500);
        }
    }
    if (!is_numeric($data['zone_id'])) {
        return false;
    }
    /* Get the Publication */
    $query = "SELECT publication_id FROM md_zones WHERE entry_id='" . $data['zone_id'] . "'";
    $zone_detail = simple_query_maindb($query, true, 1000);
    if (!$zone_detail or $zone_detail['publication_id'] < 1) {
        return false;
    }
    switch ($data['type']) {
        case 'normal':
            reporting_db_update($zone_detail['publication_id'], $data['zone_id'], $data['campaign_id'], $data['ad_id'], '', 0, 0, 0, 1);
            break;
        case 'network':
            reporting_db_update($zone_detail['publication_id'], $data['zone_id'], $data['campaign_id'], '', $data['network_id'], 0, 0, 0, 1);
            break;
        case 'backfill':
            reporting_db_update($zone_detail['publication_id'], $data['zone_id'], '', '', $data['network_id'], 0, 0, 0, 1);
            break;
    }
}
开发者ID:aiurlano,项目名称:mAdserve-Fork,代码行数:32,代码来源:c_f.php


示例9: cache_all

 /**
  * 更新内容模块栏目缓存
  * @return bool
  */
 public function cache_all()
 {
     $db = load_class('db');
     $result = $db->get_list('category', '', '*', 0, 10000, 'sort ASC,cid ASC');
     //所有内容模块栏目缓存,仅缓存name,url,cid,pid,child
     $all = array();
     foreach ($result as $v) {
         $tmp = array();
         $tmp['name'] = $v['name'];
         $tmp['pid'] = $v['pid'];
         $tmp['child'] = $v['child'];
         $tmp['modelid'] = $v['modelid'];
         $tmp['catdir'] = $v['catdir'];
         $tmp['url'] = $v['url'];
         $tmp['showloop'] = $v['showloop'];
         $tmp['type'] = $v['type'];
         $tmp['showhtml'] = $v['showhtml'];
         $tmp['listhtml'] = $v['listhtml'];
         $tmp['language'] = $v['language'];
         $tmp['siteid'] = $v['siteid'];
         $tmp['icon'] = $v['icon'];
         if ($v['domain']) {
             $tmp['domain'] = $v['domain'];
         }
         $all[$v['cid']] = $tmp;
         set_cache('category_' . $v['cid'], $v, 'content');
     }
     set_cache('category', $all, 'content');
     return true;
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:34,代码来源:category_cache.class.php


示例10: myAction

 public function myAction()
 {
     $userid = $this->admin['userid'];
     if ($this->post('submit')) {
         $data = $this->post('data');
         if (!empty($data['password'])) {
             if (strlen($data['password']) < 6) {
                 $this->show_message('密码最少6位数', 2);
             }
             $data['password'] = md5(md5($data['password']));
         } else {
             unset($data['password']);
         }
         if ($data['auth']) {
             unset($data['auth']);
         }
         if ($data['roleid']) {
             unset($data['roleid']);
         }
         $this->db->setTableName('admin')->update($data, 'userid=?', $userid);
         $data = array();
         foreach ($this->db->setTableName('admin')->findAll() as $t) {
             unset($t['password']);
             $data[$t['userid']] = $t;
         }
         set_cache('admin', $data);
         $this->show_message('修改成功', 1);
     }
     $data = $this->db->setTableName('admin')->find($userid);
     include $this->admin_tpl('my');
 }
开发者ID:43431655,项目名称:qizhongbao,代码行数:31,代码来源:index.php


示例11: cacheAction

 public function cacheAction()
 {
     $data = array();
     foreach ($this->db->setTableName('block')->findAll() as $t) {
         $data[$t['id']] = $t;
     }
     set_cache('block', $data);
 }
开发者ID:43431655,项目名称:qizhongbao,代码行数:8,代码来源:block.php


示例12: cache

 public function cache()
 {
     $result = $this->db->get_list('linkage', '', '*', 0, 10000, 0, 'linkageid DESC');
     foreach ($result as $r) {
         set_cache('config_' . $r['linkageid'], $r, 'linkage');
     }
     return true;
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:8,代码来源:cache_linkage.class.php


示例13: init

 /**
  * 基本设置
  */
 public function init()
 {
     if (isset($GLOBALS['submit'])) {
         $setting = array_map('remove_xss', $GLOBALS['form']);
         set_cache('sms_config', $setting, 'sms');
         MSG('更新成功', HTTP_REFERER);
     } else {
         $setting = get_cache('sms_config', 'sms');
         include $this->template('setting');
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:14,代码来源:index.php


示例14: save_page_data

function save_page_data($page, $sort, $per_page)
{
    $cache_key = build_cache_key($page, $sort);
    $result = get_cache($cache_key);
    if (!$result) {
        $data = get_products($page, $per_page, true);
        $ids = '';
        foreach ($data as $product) {
            $ids .= $product[0] . ',';
        }
        set_cache($cache_key, substr($ids, 0, -1));
    }
}
开发者ID:etti-a2t,项目名称:catalog,代码行数:13,代码来源:cache_functions.php


示例15: _update_gameworld_value

function _update_gameworld_value()
{
    global $game_kv;
    $gameworld_info = array();
    $sql = "SELECT * FROM s_game_kv";
    $rst = mysql_x_query($sql);
    while ($row = mysql_fetch_assoc($rst)) {
        $gameworld_info[$row['key']] = $row['value'];
    }
    set_cache('', 'gameworld_info', $gameworld_info);
    $game_kv = $gameworld_info;
    return $gameworld_info;
}
开发者ID:laiello,项目名称:po-php-fwlite,代码行数:13,代码来源:cache_info.func.php


示例16: find_resource

 public function find_resource($type_id, $id)
 {
     if (!isset($this->types[$type_id])) {
         return NULL;
     }
     $class_name = $this->types[$type_id];
     $resource = get_cache($class_name, $class_name . '_id', $id);
     if (is_null($resource)) {
         $resource = new $class_name($id);
         set_cache($resource, $class_name . '_id', $id);
     }
     return $resource;
 }
开发者ID:119155012,项目名称:kals,代码行数:13,代码来源:KALS_resource.php


示例17: cache_all

 /**
  * 更新敏感词缓存,默认最多1万个敏感词
  * @return bool
  */
 public function cache_all()
 {
     $db = load_class('db');
     $result = $db->get_list('badword', '', 'word', 0, 10000);
     $tmp = "<?php return array(";
     foreach ($result as $rs) {
         $tmp .= "'" . $rs['word'] . "',";
     }
     $tmp .= ")?>";
     // print_r($tmp);exit;
     set_cache('badword', $tmp);
     return true;
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:17,代码来源:badword.class.php


示例18: is_set_cookie

function is_set_cookie($str)
{
    $cache_type = array('image/jpeg', 'image/gif', 'image/png', 'text/javascript', 'text/css');
    $arr = split(": ", $str);
    if ($arr[0] == "Content-Type" && in_array(trim($arr[1]), $cache_type)) {
        set_cache();
    }
    if ($arr[0] == "Set-Cookie") {
        to_set_cookie($arr[1]);
        return true;
    } else {
        return false;
    }
}
开发者ID:haseok86,项目名称:millkencode,代码行数:14,代码来源:index.php


示例19: _update_all_areas

function _update_all_areas()
{
    global $g_xcache_enabled;
    $sql = "SELECT * FROM s_map_area";
    $rst = mysql_x_query($sql);
    while ($row = mysql_fetch_assoc($rst)) {
        $all_areas[$row['area_type']][$row['area_id']] = $row;
    }
    if ($g_xcache_enabled) {
        set_xcache('sys', 'all_area', $all_areas, 0);
    } else {
        set_cache('sys', 'all_area', $all_areas, 0);
    }
    return $all_areas;
}
开发者ID:laiello,项目名称:po-php-fwlite,代码行数:15,代码来源:areas.func.php


示例20: get_count_product

function get_count_product()
{
    $c = get_connection();
    $result = get_cache('total_count');
    if (!$result) {
        $q = 'SELECT product_stat.value FROM product_stat where name= "product_count"';
        $res = mysqli_query($c, $q);
        $row = mysqli_fetch_row($res);
        if (empty($row[0])) {
            $row[0] = 0;
        }
        set_cache('total_count', $row[0]);
        return $row[0];
    }
    return $result;
}
开发者ID:etti-a2t,项目名称:catalog,代码行数:16,代码来源:db_functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_cache_flag函数代码示例发布时间:2022-05-15
下一篇:
PHP set_breadcrumb函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap