class AwsCredentialCache

Constants

protected REFRESH_WINDOW

The number of seconds before expiration that credentials should be refreshed.

protected LOCK_SECONDS

The number of seconds the credential refresh lock should be maintained.

protected LOCK_WAIT_SECONDS

The number of seconds to wait for another process to refresh credentials.

Properties

protected Repository $repository

The resolver for the backing cache repository.

protected null|Repository $fallback

The resolver for the fallback cache repository, if any.

Methods

__construct(Closure $repository, Closure|null $fallback = null)

Create a new AWS credential cache.

PromiseInterface
resolve(string $key, callable $provider)

Resolve credentials while sharing a single refresh across processes.

CredentialsInterface|null
freshCredentials(string $key)

Get fresh credentials from the available cache repositories.

PromiseInterface
resolveAndCache(string $key, callable $provider, Lock|null $lock = null)

Resolve and cache credentials before releasing the refresh lock.

void
put(string $key, CredentialsInterface $credentials, int $ttl)

Store the credentials, silently ignoring unavailable cache stores.

void
forget(string $key)

Remove the cached credentials, silently ignoring unavailable cache stores.

array
repositories()

Get the cache repository resolvers in order of preference.

void
release(Lock|null $lock)

Release the credential refresh lock without affecting credential resolution.

never
releaseAfterFailure(Lock|null $lock, Throwable $failure)

Release the credential refresh lock while preserving the primary failure.

Details

at line 55
__construct(Closure $repository, Closure|null $fallback = null)

Create a new AWS credential cache.

Parameters

Closure $repository
Closure|null $fallback

at line 64
PromiseInterface resolve(string $key, callable $provider)

Resolve credentials while sharing a single refresh across processes.

Parameters

string $key
callable $provider

Return Value

PromiseInterface

at line 113
protected CredentialsInterface|null freshCredentials(string $key)

Get fresh credentials from the available cache repositories.

Parameters

string $key

Return Value

CredentialsInterface|null

at line 137
protected PromiseInterface resolveAndCache(string $key, callable $provider, Lock|null $lock = null)

Resolve and cache credentials before releasing the refresh lock.

Parameters

string $key
callable $provider
Lock|null $lock

Return Value

PromiseInterface

at line 182
protected void put(string $key, CredentialsInterface $credentials, int $ttl)

Store the credentials, silently ignoring unavailable cache stores.

Parameters

string $key
CredentialsInterface $credentials
int $ttl

Return Value

void

at line 198
protected void forget(string $key)

Remove the cached credentials, silently ignoring unavailable cache stores.

Parameters

string $key

Return Value

void

at line 216
protected array repositories()

Get the cache repository resolvers in order of preference.

Return Value

array

at line 224
protected void release(Lock|null $lock)

Release the credential refresh lock without affecting credential resolution.

Parameters

Lock|null $lock

Return Value

void

at line 241
protected never releaseAfterFailure(Lock|null $lock, Throwable $failure)

Release the credential refresh lock while preserving the primary failure.

A cancellation during cleanup replaces an ordinary failure, but never an original cancellation.

Parameters

Lock|null $lock
Throwable $failure

Return Value

never