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


PHP Pool::get方法代码示例

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


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

示例1: assertHit

 protected function assertHit($expected, Pool $pool, $key)
 {
     $this->assertEquals($expected, $pool->get($key));
     $this->assertEquals($expected, $pool->getItem($key)->get());
     $this->assertTrue($pool->getItem($key)->isHit());
     $this->assertTrue($pool->hasItem($key));
 }
开发者ID:jivoo,项目名称:jivoo,代码行数:7,代码来源:PoolTest.php

示例2: wrap

 public static function wrap($coroutine)
 {
     if ($coroutine instanceof \Generator) {
         $coKey = $coroutine->key();
         $coValue = $coroutine->current();
         if ($coKey && in_array($coKey, self::$_ioQueue)) {
             try {
                 $client = \Pool::get($coKey, $coValue);
                 if ($client) {
                     $client->setCoroutine($coroutine);
                     $coroutine->send($client);
                 } else {
                     Queue::push($coKey, $coroutine);
                 }
             } catch (exception $e) {
                 $coroutine->throw($e);
             }
         } else {
             if ($coValue instanceof \Coroutine\Base) {
                 $coValue->setCoroutine($coroutine);
             }
         }
     }
     return $coroutine;
 }
开发者ID:jmuyuyang,项目名称:co-psf,代码行数:25,代码来源:Coroutine.php

示例3: resolveAttributes

 /**
  * Resolve a files extended attributes
  *
  * @access public
  *
  * @param $retval file extended attributes
  */
 public static function resolveAttributes(&$retval)
 {
     Log::in("query - resolveAtributes");
     /* For printing via modxfs-getfattr for instance we need to
      * resolve things like user number to a name, template id to
      * a name, dates into strings etc.
      * We are only using select statements here, if a query fails
      * just leave the attribute alone and move on.
      */
     $dbConn = Pool::get();
     $prefix = Pool::getTableprefix();
     foreach ($retval as $key => &$value) {
         switch ($key) {
             case 'editedon':
             case 'createdon':
             case 'pub_date':
             case 'unpub_date':
             case 'deletedon':
             case 'publishedon':
                 $value = strftime("%G-%m-%j %H:%M:%S", $value);
                 break;
             case 'parent':
                 $sql = "SELECT pagetitle";
                 $sql .= " FROM `{$prefix}" . "site_content`";
                 $sql .= " WHERE id = {$value}";
                 $result = mysql_query($sql, $dbConn);
                 if ($result !== false) {
                     $row = mysql_fetch_assoc($result);
                     if ($row['pagetitle'] != "") {
                         $value = $row['pagetitle'];
                     }
                 }
                 break;
             case 'template':
                 $sql = "SELECT templatename";
                 $sql .= " FROM `{$prefix}" . "site_templates`";
                 $sql .= " WHERE id = {$value}";
                 $result = mysql_query($sql, $dbConn);
                 if ($result !== false) {
                     $row = mysql_fetch_assoc($result);
                     if ($row['templatename'] != "") {
                         $value = $row['templatename'];
                     }
                 }
                 break;
             case 'editedby':
             case 'deletedby':
             case 'publishedby':
             case 'createdby':
                 /* Only manager users here */
                 $sql = "SELECT username";
                 $sql .= " FROM `{$prefix}" . "manager_users`";
                 $sql .= " WHERE id = {$value}";
                 $result = mysql_query($sql, $dbConn);
                 if ($result !== false) {
                     $row = mysql_fetch_assoc($result);
                     if ($row['username'] != "") {
                         $value = $row['username'];
                     }
                 }
                 break;
             default:
                 break;
         }
     }
     Pool::release($dbConn);
     Log::out("query - resolveAtributes");
 }
开发者ID:shamblett,项目名称:modxfs-php,代码行数:75,代码来源:query.class.php


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