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


PHP Google_Client::getCache方法代码示例

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


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

示例1: getCachedRequest

 /**
  * @visible for testing.
  *
  * @param Google_Http_Request $request
  *
  * @return Google_Http_Request|bool Returns the cached object or
  *                                  false if the operation was unsuccessful.
  */
 public function getCachedRequest(Google_Http_Request $request)
 {
     if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
         return false;
     }
     return $this->client->getCache()->get($request->getCacheKey());
 }
开发者ID:nabble,项目名称:ajde,代码行数:15,代码来源:Abstract.php

示例2: testSettersGetters

 public function testSettersGetters()
 {
     $client = new Google_Client();
     $client->setClientId("client1");
     $client->setClientSecret('client1secret');
     $client->setState('1');
     $client->setApprovalPrompt('force');
     $client->setAccessType('offline');
     global $apiConfig;
     $this->assertEquals('client1', $apiConfig['oauth2_client_id']);
     $this->assertEquals('client1secret', $apiConfig['oauth2_client_secret']);
     $client->setRedirectUri('localhost');
     $client->setApplicationName('me');
     $client->setUseObjects(false);
     $this->assertEquals('object', gettype($client->getAuth()));
     $this->assertEquals('object', gettype($client->getCache()));
     $this->assertEquals('object', gettype($client->getIo()));
     $client->setAuthClass('Google_AuthNone');
     $client->setAuthClass('Google_OAuth2');
     try {
         $client->setAccessToken(null);
         die('Should have thrown an Google_AuthException.');
     } catch (Google_AuthException $e) {
         $this->assertEquals('Could not json decode the token', $e->getMessage());
     }
     $token = json_encode(array('access_token' => 'token'));
     $client->setAccessToken($token);
     $this->assertEquals($token, $client->getAccessToken());
 }
开发者ID:ricain59,项目名称:fortaff,代码行数:29,代码来源:ApiClientTest.php

示例3: testAppEngineAutoConfig

 /**
  * @requires extension Memcached
  */
 public function testAppEngineAutoConfig()
 {
     $_SERVER['SERVER_SOFTWARE'] = 'Google App Engine';
     $client = new Google_Client();
     $this->assertInstanceOf('Google_Cache_Memcache', $client->getCache());
     $this->assertInstanceOf('Google_Io_Stream', $client->getIo());
     unset($_SERVER['SERVER_SOFTWARE']);
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:11,代码来源:ApiClientTest.php

示例4: testAppEngineAutoConfig

 public function testAppEngineAutoConfig()
 {
     if (!class_exists("Memcached")) {
         $this->markTestSkipped('Test requires memcache');
     }
     $_SERVER['SERVER_SOFTWARE'] = 'Google App Engine';
     $client = new Google_Client();
     $this->assertInstanceOf('Google_Cache_Memcache', $client->getCache());
     unset($_SERVER['SERVER_SOFTWARE']);
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:10,代码来源:ApiClientTest.php

示例5: testSettersGetters

 public function testSettersGetters()
 {
     $client = new Google_Client();
     $client->setClientId("client1");
     $client->setClientSecret('client1secret');
     $client->setState('1');
     $client->setApprovalPrompt('force');
     $client->setAccessType('offline');
     $client->setRedirectUri('localhost');
     $client->setConfig('application_name', 'me');
     $client->setCache($this->getMock('Psr\\Cache\\CacheItemPoolInterface'));
     $this->assertEquals('object', gettype($client->getCache()));
     try {
         $client->setAccessToken(null);
         $this->fail('Should have thrown an Exception.');
     } catch (InvalidArgumentException $e) {
         $this->assertEquals('invalid json token', $e->getMessage());
     }
     $token = array('access_token' => 'token');
     $client->setAccessToken($token);
     $this->assertEquals($token, $client->getAccessToken());
 }
开发者ID:jvidor,项目名称:google-api-php-client,代码行数:22,代码来源:ClientTest.php

示例6: testAppEngineAutoConfig

 /**
  * @requires extension Memcached
  */
 public function testAppEngineAutoConfig()
 {
     $_SERVER['SERVER_SOFTWARE'] = 'Google App Engine';
     $client = new Google_Client();
     $this->assertInstanceOf('Google_Cache_Memcache', $client->getCache());
     // check Stream Handler is used
     $http = $client->getHttpClient();
     $class = new ReflectionClass(get_class($http));
     $property = $class->getProperty('fsm');
     $property->setAccessible(true);
     $fsm = $property->getValue($http);
     $class = new ReflectionClass(get_class($fsm));
     $property = $class->getProperty('handler');
     $property->setAccessible(true);
     $handler = $property->getValue($fsm);
     $this->assertInstanceOf('GuzzleHttp\\Ring\\Client\\StreamHandler', $handler);
     unset($_SERVER['SERVER_SOFTWARE']);
 }
开发者ID:OlivierBarbier,项目名称:google-api-php-client,代码行数:21,代码来源:ClientTest.php


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