class GCECache (View source)

A class to implement caching for calls to GCECredentials::onGce. This class is used automatically when you pass a Psr\Cache\CacheItemPoolInterface cache object to ApplicationDefaultCredentials::getCredentials.

$sysvCache = new Google\Auth\SysvCacheItemPool();
$creds = Google\Auth\ApplicationDefaultCredentials::getCredentials(
    $scope,
    null,
    null,
    $sysvCache
);

Traits

Constants

GCE_CACHE_KEY

Methods

__construct(array $cacheConfig = null, CacheItemPoolInterface $cache = null)

No description

bool
onGce(callable $httpHandler = null)

Caches the result of onGce so the metadata server is not called multiple times.

Details

__construct(array $cacheConfig = null, CacheItemPoolInterface $cache = null)

Parameters

array $cacheConfig Configuration for the cache
CacheItemPoolInterface $cache

bool onGce(callable $httpHandler = null)

Caches the result of onGce so the metadata server is not called multiple times.

Parameters

callable $httpHandler callback which delivers psr7 request

Return Value

bool True if this a GCEInstance, false otherwise