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


PHP set_cache函数代码示例

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


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


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