Skip to content

Conversation

@LexioJ
Copy link

@LexioJ LexioJ commented Oct 26, 2025

What does this PR fix?

Fixes #56012

Changes

The ReferenceManager was ignoring the getCacheTTL() method defined in the IReferenceProvider interface and always using the hardcoded 3600 second TTL.

This change respects the provider's custom cache TTL with a fallback to the default CACHE_TTL constant, allowing providers to specify shorter TTLs for frequently-changing data such as external API integrations.

Implementation

  • Call getCacheTTL() on the matched provider
  • Use the returned TTL if specified, otherwise fallback to self::CACHE_TTL
  • Apply the TTL to both the prefix marker cache and the reference cache

Backward Compatibility

✅ Fully backward compatible:

  • Existing providers that don't override getCacheTTL() will get the default 3600s TTL
  • The change is purely additive and doesn't modify any API signatures

@LexioJ LexioJ requested a review from a team as a code owner October 26, 2025 10:26
@LexioJ LexioJ requested review from Altahrim, leftybournes, salmart-dev and yemkareems and removed request for a team October 26, 2025 10:26
@LexioJ LexioJ force-pushed the fix/reference-manager-respect-cache-ttl branch from 7fff926 to 1b5584d Compare October 26, 2025 10:28
…eManager

The ReferenceManager was ignoring the getCacheTTL() method defined in the
IReferenceProvider interface and always using the hardcoded 3600 second TTL.

This change respects the provider's custom cache TTL with a fallback to the
default CACHE_TTL constant, allowing providers to specify shorter TTLs for
frequently-changing data such as external API integrations.

Fixes nextcloud#56012

Signed-off-by: Alexander Askin <lexioj@gmail.com>
@LexioJ LexioJ force-pushed the fix/reference-manager-respect-cache-ttl branch from 1b5584d to 8a95c7b Compare October 26, 2025 21:10
@susnux
Copy link
Contributor

susnux commented Oct 28, 2025

Thank you for the pull request!
As mentioned in the issue: #56012 (comment)
This method does not exist in the interface.

Please open a feature request if you need such a method

@susnux susnux closed this Oct 28, 2025
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.

ReferenceManager ignores IReferenceProvider::getCacheTTL() - always uses hardcoded 3600s

2 participants