Skip to content

Add locking to FetchAuthTokenCache #226

@ericnorris

Description

@ericnorris

Per #225, filing an additional ticket for this feature request. Thanks again!

Is your feature request related to a problem? Please describe.

The SysVCacheItemPool class points out that calling code should handle race conditions, but the FetchAuthTokenCache class, which is used by the google-cloud-php library when the authCache parameter is passed in (see here), does not do any locking.

This means that users that follow code examples such as the following (from here):

$authCache = new SysVCacheItemPool();
$sessionCache = new SysVCacheItemPool([
    // Use a different project identifier for ftok than the default
    'proj' => 'B'
]);

$spanner = new SpannerClient([
    'authCache' => $authCache
]);

...may run into race condition issues unknowingly.

Describe the solution you'd like

Either of the two:

  • FetchAuthTokenCache adds a locking mechanism to safely use the passed inCacheItemPoolInterface
  • I file an issue in the google-cloud-php repository to request it use a cache with locking built in.

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions