GCECache
in package
uses
CacheTrait
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
);
Table of Contents
Constants
- GCE_CACHE_KEY = 'google_auth_on_gce_cache'
Properties
- $cache : CacheItemPoolInterface
- $cacheConfig : array<string|int, mixed>
- $maxKeyLength : mixed
Methods
- __construct() : mixed
- onGce() : bool
- Caches the result of onGce so the metadata server is not called multiple times.
- getCachedValue() : mixed
- Gets the cached value if it is present in the cache when that is available.
- getFullCacheKey() : mixed
- setCachedValue() : mixed
- Saves the value in the cache when that is available.
Constants
GCE_CACHE_KEY
public
mixed
GCE_CACHE_KEY
= 'google_auth_on_gce_cache'
Properties
$cache
private
CacheItemPoolInterface
$cache
$cacheConfig
private
array<string|int, mixed>
$cacheConfig
$maxKeyLength
private
mixed
$maxKeyLength
= 64
Methods
__construct()
public
__construct([array<string|int, mixed> $cacheConfig = null ][, CacheItemPoolInterface $cache = null ]) : mixed
Parameters
- $cacheConfig : array<string|int, mixed> = null
-
Configuration for the cache
- $cache : CacheItemPoolInterface = null
onGce()
Caches the result of onGce so the metadata server is not called multiple times.
public
onGce([callable $httpHandler = null ]) : bool
Parameters
- $httpHandler : callable = null
-
callback which delivers psr7 request
Return values
bool —True if this a GCEInstance, false otherwise
getCachedValue()
Gets the cached value if it is present in the cache when that is available.
private
getCachedValue(mixed $k) : mixed
Parameters
- $k : mixed
getFullCacheKey()
private
getFullCacheKey(mixed $key) : mixed
Parameters
- $key : mixed
setCachedValue()
Saves the value in the cache when that is available.
private
setCachedValue(mixed $k, mixed $v) : mixed
Parameters
- $k : mixed
- $v : mixed