Skip to content

CXF-9237 - Add possibility to configure JCache expiry time - #3370

Closed
coheigea wants to merge 1 commit into
mainfrom
coheigea/CXF-9237
Closed

CXF-9237 - Add possibility to configure JCache expiry time#3370
coheigea wants to merge 1 commit into
mainfrom
coheigea/CXF-9237

Conversation

@coheigea

Copy link
Copy Markdown
Contributor

By default there is no eviction for backwards compatibility

@coheigea
coheigea requested a review from reta August 13, 2026 10:49
// cacheTTLs lets the access/refresh token caches be evicted by the JCache infrastructure
// itself once entries age out, independently of any application-level expiry check;
// a TTL <= 0 (CacheTTLs.ETERNAL by default) leaves the corresponding cache eternal
public JCacheOAuthDataProvider(String configFileURL,

@reta reta Aug 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@coheigea thanks for the change, what concerns me is that cacheTTLs gives a wrong impression that TTL will be configured for each cache, but that is not the case: if the configuration has dedicated cache preset (like below)

  <cache alias="cxf.oauth2.accesstoken.cache">
    <key-type>java.lang.String</key-type>
    <value-type>org.apache.cxf.rs.security.oauth2.common.ServerAccessToken</value-type>
    <heap unit="entries">100</heap>
    <jsr107:mbeans enable-management="false" enable-statistics="false"/>
  </cache>

the cacheTTL will be effectively ignored. I don't want to complicate it but also looking for intuitive API usage, may be instead of CacheTTLs cacheTTLs we introduce something like JCacheCreator (or alike) that will be used to create a cache when the is no one in configuration? Wdyt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Something along these lines:

interface JCacheCreator  {
    <K, V> Cache<K, V> createCache(CacheManager cacheManager, String cacheKey, MutableConfiguration<K, V> config);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @reta , maybe in that case we don't need this improvement at all if the user can configure the TTL in the config?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @coheigea , that is also a valid point, we may not even need it

@coheigea coheigea closed this Aug 13, 2026
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.

2 participants