# Google Auth Library Client - Class GCECache (1.50.1)

1.50.1 (latest) 1.50.0 1.49.0 1.48.1 1.47.1 1.46.0 1.45.2 Reference documentation and code samples for the Google Auth Library Client class GCECache.

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
    );

## Namespace

Google \\ Auth

## Methods

### __construct

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `cacheConfig` | `array` Configuration for the cache |
| `cache` | `Psr\Cache\CacheItemPoolInterface` |

### onGce

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `callable|null` callback which delivers psr7 request |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if this a GCEInstance, false otherwise |

## Constants

### GCE_CACHE_KEY

    Value: 'google_auth_on_gce_cache'