Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,12 @@ public class MetadataCacheConfig {
* A negative or zero value disables automatic expiration.
*/
@Builder.Default
private final long expireAfterWriteMillis = 2 * DEFAULT_CACHE_REFRESH_TIME_MILLIS;
private final long expireAfterWriteMillis = 0L;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change the default value to -1. Use -1 to disable the expire maybe better to understand.


/**
* Specifies that each entry should be automatically removed from the cache once a fixed duration
* has elapsed after the entry's creation, the most recent replacement of its value, or its last access.
* A negative or zero value disables automatic expiration.
*/
private final long expireAfterAccessMillis = 2 * DEFAULT_CACHE_REFRESH_TIME_MILLIS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public MetadataCacheImpl(MetadataStore store, MetadataSerde<T> serde, MetadataCa
if (cacheConfig.getExpireAfterWriteMillis() > 0) {
cacheBuilder.expireAfterWrite(cacheConfig.getExpireAfterWriteMillis(), TimeUnit.MILLISECONDS);
}
if (cacheConfig.getExpireAfterAccessMillis() > 0) {
cacheBuilder.expireAfterAccess(cacheConfig.getExpireAfterAccessMillis(), TimeUnit.MILLISECONDS);
}
this.objCache = cacheBuilder
.buildAsync(new AsyncCacheLoader<String, Optional<CacheGetResult<T>>>() {
@Override
Expand Down