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|null $cacheConfig = null, CacheItemPoolInterface|null $cache = null)

No description

bool
onGce(callable|null $httpHandler = null)

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

Details

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

No description

Parameters

array|null $cacheConfig

Configuration for the cache

CacheItemPoolInterface|null $cache

bool onGce(callable|null $httpHandler = null)

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

Parameters

callable|null $httpHandler

callback which delivers psr7 request

Return Value

bool

True if this a GCEInstance, false otherwise