Skip to content

Allow configuration of cache TTL via properties/environment #292

@adamhamlin

Description

@adamhamlin

Hi,

Very cool library. Would be curious if you would accept a PR for the following:

IMO, would be very useful to allow overriding the CacheItemTTL via properties or environment—similar to what is done for overriding the VPC region/URL.

For Spring applications, devs can start using your library w/ just 2 lines changed in application.yaml under spring.datasource. That's really powerful. But if I ALSO want to configure the cache TTL, it requires a completely in-code solution, with duplication of the default code/config relating to datasource registration and connection pooling. That's a much higher barrier to entry, and also comes with some risk and a maintenance burden.

Of all the properties w/in SecretCacheConfiguration, the cache TTL is the most likely to be overridden. The default is only 1 hr, but likely that most DB passwords are being changed on the order of months. Each Secrets Manager fetch comes with a cost, so reducing unnecessary fetches has a financial incentive at scale—not just the desire to reduce CPU cycles and network load.

Also, this issue has come up or been mentioned a few times in the past, see #56 and #168.

Again, happy to provide a PR for this! Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions