Add refresh_strategy argument to Connector() that allows setting
the strategy to "lazy" to use a lazy refresh strategy.
When creating a Connector via Connector(refresh_strategy="lazy"),
the connection info and ephemeral certificate will be refreshed only
when the cache certificate has expired. No background tasks run
periodically with this option, making it ideal for use in serverless
environments such as Cloud Run, Cloud Functions, etc, where the
CPU may be throttled.
Usage example:
from google.cloud.alloydb.connector import Connector
with Connector(refresh_strategy="lazy") as connector:
# ... use connector in lazy refresh mode
Add
refresh_strategy
argument toConnector()
that allows setting the strategy to"lazy"
to use a lazy refresh strategy.When creating a Connector via
Connector(refresh_strategy="lazy")
, the connection info and ephemeral certificate will be refreshed only when the cache certificate has expired. No background tasks run periodically with this option, making it ideal for use in serverless environments such as Cloud Run, Cloud Functions, etc, where the CPU may be throttled.Usage example:
Port of https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/pull/1093
Closes #298