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


PHP Services::memcacheLoaded方法代码示例

本文整理汇总了PHP中Services::memcacheLoaded方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::memcacheLoaded方法的具体用法?PHP Services::memcacheLoaded怎么用?PHP Services::memcacheLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Services的用法示例。


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

示例1: readModuleListCache

 /**
  * Loads modules from memcache
  */
 protected function readModuleListCache()
 {
     // check for memcache extension
     if (!Services::memcacheLoaded()) {
         return false;
     }
     // check for stored data
     if (!Services::getMemcache()->get('moduleList') or !Services::getMemcache()->get('botInstances')) {
         return false;
     }
     // load data
     $modules = Services::getMemcache()->get('moduleList');
     $botInstances = Services::getMemcache()->get('botInstances');
     // debug log
     if (defined('DEBUG')) {
         Services::getConnection()->getProtocol()->sendLogLine("Loading modules from cache ...");
     }
     // start modules
     foreach ($modules as $row) {
         $this->loadModule(SDIR . 'lib/modules/' . $row['name'] . '.class.php', $row['address'], true);
     }
     // start bot instances
     foreach ($botInstances as $row) {
         $this->createBotInstance($row['moduleAddress'], $row['trigger'], $row['nick'], $row['hostname'], $row['ident'], $row['ip'], $row['modes'], $row['gecos']);
     }
     // ok all done
     return true;
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:31,代码来源:ModuleManager.class.php

示例2: removeChannel

 /**
  * Removes a channel from list
  *
  * @param	string	$name
  * @return	void
  */
 public function removeChannel($name)
 {
     if (!Services::memcacheLoaded()) {
         foreach ($this->channelList as $key => $channel) {
             if (strtolower($channel->getName()) == strtolower($name)) {
                 unset($this->channelList[$key]);
             }
         }
     } else {
         Services::getMemcache()->delete('channel_' . $name);
     }
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:18,代码来源:ChannelManager.class.php

示例3: getUserByNick

 /**
  * @see	UserTypeManager::getUserByNick()
  */
 public function getUserByNick($nickname)
 {
     if (Services::memcacheLoaded() and Services::getMemcache()->get(get_class($this) . '_data' !== false)) {
         $userList = Services::getMemcache()->get(get_class($this) . '_data');
     } else {
         $userList = $this->userList;
     }
     foreach ($userList as $key => $user) {
         if ($userList[$key]->getNick() == $nickname) {
             return $userList[$key];
         }
     }
     return null;
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:17,代码来源:AbstractUserTypeManager.class.php

示例4: initConnection

 /**
  * Starts network burst
  * 
  * @return	void
  */
 public function initConnection()
 {
     // CAPAB
     Services::getConnection()->sendLine("CAPAB START " . PROTOCOL_VERSION);
     Services::getConnection()->sendLine("CAPAB CAPABILITIES :PROTOCOL=" . PROTOCOL_VERSION);
     Services::getConnection()->sendLine("CAPAB END");
     // SERVER
     Services::getConnection()->sendLine("SERVER " . $this->name . " " . $this->password . " " . $this->hops . " " . $this->numeric . " :" . $this->description);
     // BURST
     $this->connectionState = 'burst';
     Services::getConnection()->sendServerLine("BURST " . time());
     Services::getConnection()->sendServerLine("VERSION :Evil-Co.de Services (Protocol Version 1.0.0)");
     Services::getConnection()->sendServerLine("ENDBURST");
     // handle burst ...
     $input = "";
     do {
         // read lines
         $input = Services::getConnection()->readLine();
         $inputEx = explode(" ", $input);
         // auth commands
         switch ($inputEx[0]) {
             case 'SERVER':
                 $this->serverList[] = $inputEx[1];
                 break;
         }
     } while (!isset($inputEx[1]) or $inputEx[1] != "BURST");
     // handle commands
     do {
         // read lines
         $input = Services::getConnection()->readLine();
         $input = substr($input, 1);
         $inputEx = explode(" ", $input);
         if (!empty($input) and count($inputEx) >= 2) {
             if (method_exists('ProtocolHandler', $inputEx[1])) {
                 call_user_func(array('ProtocolHandler', strtoupper($inputEx[1])), $input, $inputEx);
             }
         }
     } while (!isset($inputEx[1]) or $inputEx[1] != 'ENDBURST');
     // Endburst processed!
     // Little ... er ... easteregg ... AI for services (Or automatic management for IRC networks)
     //Services::getConnection()->sendServerLine("NOTICE ".$this->servicechannel." :Evil-Co.de Service AI is now ready!");
     // Default runtime
     while (Services::getConnection()->isAlive()) {
         // read lines
         $input = Services::getConnection()->readLine();
         $input = substr($input, 1);
         $inputEx = explode(" ", $input);
         if (!empty($input) and count($inputEx) >= 2) {
             if (method_exists('ProtocolHandler', $inputEx[1])) {
                 call_user_func(array('ProtocolHandler', strtoupper($inputEx[1])), $input, $inputEx);
             }
         }
         // check memcache connection
         if (Services::memcacheLoaded() and !Services::getMemcache()->checkConnection()) {
             throw new Exception("Memcache is gone away!");
         }
     }
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:63,代码来源:Protocol.class.php


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