class AwsCredentialCache (View source)

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 Repository|null $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 = 0)

Store the credentials, silently ignoring unavailable cache stores.

void
forget(string $key)

Remove the cached credentials, silently ignoring unavailable cache stores.

Repository>
repositories()

Get the cache repository resolvers in order of preference.

void
release(Lock|null $lock)

Release the credential refresh lock without affecting credential resolution.

Details

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

Create a new AWS credential cache.

Parameters

Closure $repository
Closure|null $fallback

PromiseInterface resolve(string $key, callable $provider)

Resolve credentials while sharing a single refresh across processes.

Parameters

string $key
callable $provider

Return Value

PromiseInterface

protected CredentialsInterface|null freshCredentials(string $key)

Get fresh credentials from the available cache repositories.

Parameters

string $key

Return Value

CredentialsInterface|null

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

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

Store the credentials, silently ignoring unavailable cache stores.

Parameters

string $key
CredentialsInterface $credentials
int $ttl

Return Value

void

protected void forget(string $key)

Remove the cached credentials, silently ignoring unavailable cache stores.

Parameters

string $key

Return Value

void

protected Repository> repositories()

Get the cache repository resolvers in order of preference.

Return Value

Repository>

protected void release(Lock|null $lock)

Release the credential refresh lock without affecting credential resolution.

Parameters

Lock|null $lock

Return Value

void