-
-
Couldn't load subscription status.
- Fork 4.6k
Description
Problem
The IReferenceProvider interface defines a getCacheTTL() method that allows reference providers to specify custom cache TTLs. However, ReferenceManager::resolveReference() ignores this method and always caches resolved references for a hardcoded 3600 seconds.
This prevents providers from implementing shorter TTLs for frequently-changing data (e.g., external API data that updates more frequently than 1 hour).
Current Behavior
In lib/private/Collaboration/Reference/ReferenceManager.php line 125:
$this->cache->set($cacheKey, Reference::toCache($reference), self::CACHE_TTL); // Always 3600sThe provider's getCacheTTL() return value is never consulted.
Expected Behavior
ReferenceManager should respect the provider's getCacheTTL() method:
$ttl = $matchedProvider->getCacheTTL() ?? self::CACHE_TTL;
$this->cache->set($cacheKey, Reference::toCache($reference), $ttl);Benefits
- Allows providers to define appropriate TTLs for their data
- Maintains backward compatibility (null returns fallback to 3600s)
- Aligns with existing interface design
- Minimal code change (1-2 lines)
Use Case
External integrations (e.g., ticketing systems, configuration management) often have data that changes more frequently than 1 hour. Providers should be able to specify shorter TTLs (e.g., 60 seconds) without being blocked by Nextcloud's hardcoded cache duration.