Skip to content

Conversation

@adityapatwardhan
Copy link
Member

PR Summary

This pull request introduces caching for container registry access tokens in the ContainerRegistryServerAPICalls class to avoid unnecessary repeated retrievals. The main changes focus on improving performance and reducing redundant network calls by storing and reusing the access token during the object's lifetime.

Container registry access token caching:

  • Added a private field _cachedContainterRegistryToken to store the access token for reuse.
  • Initialized the cached token to null in the constructor to ensure a fresh start for each instance.
  • Updated GetContainerRegistryAccessToken to check for and return the cached token if available, logging a verbose message when the cache is used.
  • After successfully retrieving a new access token, the method now stores it in the cache and logs a verbose message.

PR Context

In local testing, the improvement in performance for find with wildcard improved by 88% and install with dependencies improved by 83%

NOTE: We create a new instance of ContainerRegistryServerAPICalls for each invocation of any cmdlet. The cache is only shared within a single cmdlet invocation.

PR Checklist

@adityapatwardhan
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@anamnavi anamnavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants