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


PHP memcache_init函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->_memcached = memcache_init();
     $CI =& get_instance();
     $path = $CI->config->item('cache_path');
     $this->_prefixKey = $path == '' ? 'system_cache_' : $path;
 }
开发者ID:dlpc,项目名称:we_three,代码行数:7,代码来源:Cache_memcached.php

示例2: get_channel_url

function get_channel_url($uid = null)
{
    if (!is_login()) {
        return false;
    }
    /*
    $channel = new SaeChannel();
    $channel_name = 'NowBoard';
    $duration = 3600;
    $url = $channel->createChannel( wbuid().'.'.$channel_name,$duration);
    */
    if ($uid == null) {
        $uid = wbuid();
    }
    $urlkey = 'nowboard-url-all';
    $mc = memcache_init();
    if (!($url = $mc->get($urlkey))) {
        $channel = new SaeChannel();
        $channel_name = $urlkey;
        $duration = 3600;
        $url = $channel->createChannel($channel_name, $duration);
        $mc->set($urlkey, $url, 0, 3600);
    }
    return $url;
}
开发者ID:oxmcvusd,项目名称:nowboard,代码行数:25,代码来源:app.function.php

示例3: _display_cache

 /**
  * Update/serve a cached file
  *
  * @access	public
  * @param 	object	config class
  * @param 	object	uri class
  * @return	void
  */
 function _display_cache(&$CFG, &$URI)
 {
     $cache_adapter;
     $cach_model = $CFG->item('sae_output_cache');
     $status;
     switch ($cach_model) {
         case '':
             return FALSE;
             break;
         case 'kvdb':
             $cache_adapter = new SaeKV();
             $status = $cache_adapter->init();
             break;
         case 'memcache':
             $cache_adapter = memcache_init();
             $status = $cache_adapter;
             break;
     }
     if (!$status) {
         return FALSE;
     }
     $uri = $CFG->item('base_url') . $CFG->item('index_page') . $URI->uri_string;
     $cache_key = md5($uri);
     $cache = $cache_adapter->get($cache_key);
     if ($cache === FALSE) {
         //缓存已过期
         log_message('debug', "Cache has expired.");
         return FALSE;
     } else {
         //输出缓存
         log_message('debug', "Cache is current. Sending it to browser.");
         $this->_display($cache);
         return TRUE;
     }
 }
开发者ID:dlpc,项目名称:we_three,代码行数:43,代码来源:SAE_Output.php

示例4: getRights

 private function getRights()
 {
     $gid = (int) $_COOKIE['gid'];
     $cacheName = "action_code_group_" . $gid;
     /*$cache = memcache_init();
     		//$cache->init ( array ("dir" => SlightPHP::$appDir . "/cache", "depth" => 3 ) );
     		$rs = $cache->get ( $cacheName );
     		if ($cache and $rs) {
     		} else {
     			$rsObj = base_mAPI::get ( 'm_group', $gid );
     			$rs = $rsObj->get ();
     			$cache->set ( $cacheName, $rs );
     		}*/
     $rsObj = base_mAPI::get('m_group', $gid);
     $rs = $rsObj->get();
     $action = unserialize($rs['action_code']);
     $mc = memcache_init();
     $head_title = $mc->get($_SERVER['HTTP_APPVERSION'] . "head_title");
     if (!$head_title) {
         $modelObj = new base_m();
         $rs = $modelObj->_db->selectOne(base_Constant::TABLE_PREFIX . "system", "", "sysname");
         $head_title = $rs['rsystem_name'];
         $mc->set($_SERVER['HTTP_APPVERSION'] . "head_title", $head_title);
     }
     $this->params['head_title'] = $head_title;
     $this->params['menu'] = $action['menu'];
     $this->params['_userid'] = $_COOKIE['admin_id'];
     $this->params['_adminname'] = $_COOKIE['admin_name'];
 }
开发者ID:jianyongchen,项目名称:smpss,代码行数:29,代码来源:c.class.php

示例5: __construct

 function __construct($configs)
 {
     $this->cache = \memcache_init();
     if ($this->cache === false) {
         throw new \Exception("SaeMemcache init fail", 1);
     }
 }
开发者ID:jasonshaw,项目名称:framework-1,代码行数:7,代码来源:SaeMemcache.php

示例6: __construct

 /**
  * 构造函数,进行模板引擎的实例化操作
  */
 public function __construct()
 {
     if (FALSE == $GLOBALS['G_SP']['view']['enabled']) {
         return FALSE;
     }
     if (FALSE != $GLOBALS['G_SP']['view']['auto_ob_start']) {
         ob_start();
     }
     $this->engine = spClass($GLOBALS['G_SP']['view']['engine_name'], null, $GLOBALS['G_SP']['view']['engine_path']);
     if ($GLOBALS['G_SP']['view']['config'] && is_array($GLOBALS['G_SP']['view']['config'])) {
         $engine_vars = get_class_vars(get_class($this->engine));
         foreach ($GLOBALS['G_SP']['view']['config'] as $key => $value) {
             if (array_key_exists($key, $engine_vars)) {
                 $this->engine->{$key} = $value;
             }
         }
     }
     if (!empty($GLOBALS['G_SP']['sp_app_id']) && isset($this->engine->compile_id)) {
         $this->engine->compile_id = $GLOBALS['G_SP']['sp_app_id'];
     }
     if (empty($this->engine->no_compile_dir)) {
         memcache_init();
     }
     spAddViewFunction('T', array('spView', '__template_T'));
     spAddViewFunction('spUrl', array('spView', '__template_spUrl'));
 }
开发者ID:Geoge-Henry,项目名称:travelnote,代码行数:29,代码来源:spView.php

示例7: getLoginCookie

function getLoginCookie($openid)
{
    //数据库操作
    require_once 'utils/Mysql.class.php';
    $class_mysqlObj = new Class_mysql();
    $sql_state = "select studentid,IdCard from tb_studentInfo where openid='{$openid}'";
    $studentInfoArr = $class_mysqlObj->query_array($sql_state);
    //取出数据库里的 学号与身份证号
    $studentid = $studentInfoArr[0]['studentid'];
    $IdCard = $studentInfoArr[0]['IdCard'];
    //创建临时文件
    $cookieFile = SAE_TMP_PATH . '/personInfo_cookie.txt';
    $IdCardNum = substr($IdCard, 11, 6);
    if (strlen($IdCard) == 15) {
        $IdCardNum = substr($IdCard, 9, 6);
    }
    $login_url = "http://my.hpu.edu.cn/userPasswordValidate.portal";
    $login = "Login.Token1={$studentid}&Login.Token2={$IdCardNum}&goto=http%3A%2F%2Fmy.hpu.edu.cn%2FloginSuccess.portal&gotoOnFail=http%3A%2F%2Fmy.hpu.edu.cn%2FloginFailure.portal";
    $ch = curl_init($login_url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
    // 把返回来的cookie信息保存在文件中
    curl_exec($ch);
    curl_close($ch);
    //读取文件内容
    $personInfo_cookie = file_get_contents($cookieFile);
    $mmc = memcache_init();
    // 初始化缓存
    memcache_set($mmc, $openid . "personInfo_cookie", $personInfo_cookie, 0, 600);
    return $personInfo_cookie;
}
开发者ID:mesfreeman,项目名称:ifreeweixin,代码行数:32,代码来源:loginCookie.php

示例8: __construct

 public function __construct()
 {
     $this->mem = memcache_init();
     if (false === $this->mem) {
         throw new Gloft_Driver_Cache_Exception("memcached server init error");
     }
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:7,代码来源:memcache.php

示例9: send

 public static function send($msg, $detail, $level = self::USER, $mobile = null)
 {
     //判断是否定义需要发送短信
     if (!in_array($level, explode(',', C('SMS_LEVEL')))) {
         return;
     }
     //判断发送频率
     $mc = memcache_init();
     $is_send = $mc->get('think_sms_send');
     //如果已经发送,则不发送
     if ($is_send === 'true') {
         $status = 'not send';
     } else {
         //TODU,如果apibus类调整,此类也得调整
         $sms = apibus::init('sms');
         if (is_null($mobile)) {
             $mobile = C('SMS_MOBILE');
         }
         $mc = memcache_init();
         $obj = $sms->send($mobile, mb_substr(C('SMS_SIGN') . $msg, 0, 65, 'utf-8'), "UTF-8");
         if ($sms->isError($obj)) {
             $status = 'failed';
         } else {
             $status = 'success';
             $mc->set('think_sms_send', 'true', 0, C('SMS_INTERVAL'));
         }
     }
     //记录日志
     if (C('LOG_RECORD')) {
         Log::record($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS', true);
     } else {
         Log::write($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS');
     }
 }
开发者ID:zjstage,项目名称:ThinkPHP,代码行数:34,代码来源:Sms.class.php

示例10: sp_clear_cache

/**
 * 清空缓存
 */
function sp_clear_cache()
{
    import("ORG.Util.Dir");
    $dirs = array();
    // runtime/
    $rootdirs = scandir(RUNTIME_PATH);
    //$noneed_clear=array(".","..","Data");
    $noneed_clear = array(".", "..");
    $rootdirs = array_diff($rootdirs, $noneed_clear);
    foreach ($rootdirs as $dir) {
        if ($dir != "." && $dir != "..") {
            $dir = RUNTIME_PATH . $dir;
            if (is_dir($dir)) {
                array_push($dirs, $dir);
                $tmprootdirs = scandir($dir);
                foreach ($tmprootdirs as $tdir) {
                    if ($tdir != "." && $tdir != "..") {
                        $tdir = $dir . '/' . $tdir;
                        if (is_dir($tdir)) {
                            array_push($dirs, $tdir);
                        }
                    }
                }
            } else {
                @unlink($dir);
            }
        }
    }
    $dirtool = new Dir("");
    foreach ($dirs as $dir) {
        $dirtool->del($dir);
    }
    if (defined('IS_SAE') && IS_SAE) {
        $global_mc = @memcache_init();
        if ($global_mc) {
            $global_mc->flush();
        }
        $no_need_delete = array("THINKCMF_DYNAMIC_CONFIG");
        $kv = new SaeKV();
        // 初始化KVClient对象
        $ret = $kv->init();
        // 循环获取所有key-values
        $ret = $kv->pkrget('', 100);
        while (true) {
            foreach ($ret as $key => $value) {
                if (!in_array($key, $no_need_delete)) {
                    $kv->delete($key);
                }
            }
            end($ret);
            $start_key = key($ret);
            $i = count($ret);
            if ($i < 100) {
                break;
            }
            $ret = $kv->pkrget('', 100, $start_key);
        }
    }
}
开发者ID:Nightchen0521,项目名称:cmf,代码行数:62,代码来源:common.php

示例11: getMemCache

 public function getMemCache()
 {
     if ($this->_cache !== NULL) {
         return $this->_cache;
     } else {
         return $this->_cache = $this->useMemcached ? new Memcached() : @memcache_init();
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:8,代码来源:CMemCache.php

示例12: MoveToRoom

 protected function MoveToRoom($strKey, $openID, $roomName)
 {
     $msg = $this->rooms[$roomName]->OnOpen($strKey, $openID);
     $mc = memcache_init();
     $mc->set($openID . 'room', $roomName, 0, 300);
     //记录房间名
     return $msg;
 }
开发者ID:jeremywong1992,项目名称:phpWeJN,代码行数:8,代码来源:Map.php

示例13: __construct

 function __construct($config = array())
 {
     parent::__construct($config);
     if (defined('IS_SAE')) {
         $this->_mamcache = memcache_init() or trigger_error('Memcache Init Error', E_USER_ERROR);
     } else {
         $this->_mamcache = memcache_connect($this->host, $this->port) or trigger_error('Memcache Connect Error', E_USER_ERROR);
     }
 }
开发者ID:cos800,项目名称:tmdphp,代码行数:9,代码来源:memcache.php

示例14: __construct

 /**
  * Create a new service repository instance.
  *
  * @param  \Illuminate\Filesystem\Filesystem  $files
  * @param  string  $manifestPath
  * @return void
  */
 public function __construct(Filesystem $files, $manifestPath)
 {
     $this->files = $files;
     $this->manifestPath = $manifestPath;
     $this->isSae = $this->detectSae();
     if ($this->isSae) {
         $this->memcache = memcache_init();
     }
 }
开发者ID:chekun,项目名称:laravel4sae,代码行数:16,代码来源:ProviderRepository.php

示例15: __construct

 function __construct()
 {
     $this->mmc = memcache_init();
     //Load filenames
     $arr = self::get($this->fname_key);
     if (is_array($arr)) {
         $this->filenames = $arr;
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:9,代码来源:ETCache.class.php


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