Skip to content

Commit

Permalink
Document maintenance method
Browse files Browse the repository at this point in the history
Signed-off-by: owenhalpert <[email protected]>
  • Loading branch information
owenhalpert committed Jan 10, 2025
1 parent 71d9759 commit b135f26
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ private Float getSizeAsPercentage(long size) {
return 100 * size / (float) cbLimit;
}

/**
* Starts the scheduled maintenance for the cache. Without this thread calling cleanUp(), the Guava cache only
* performs maintenance operations (such as evicting expired entries) when the cache is accessed. This
* ensures that the cache is also cleaned up based on the configured expiry time.
* @see <a href="https://github.com/google/guava/wiki/cachesexplained#timed-eviction"> Guava Cache Guide</a>
* @param cacheInstance cache on which to call cleanUp()
*/
private void startMaintenance(Cache<String, NativeMemoryAllocation> cacheInstance) {
if (maintenanceTask != null) {
maintenanceTask.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ private void buildCache() {
}
}

/**
* Starts the scheduled maintenance for the cache. Without this thread calling cleanUp(), the Guava cache only
* performs maintenance operations (such as evicting expired entries) when the cache is accessed. This
* ensures that the cache is also cleaned up based on the configured expiry time.
* @see <a href="https://github.com/google/guava/wiki/cachesexplained#timed-eviction"> Guava Cache Guide</a>
* @param cacheInstance cache on which to call cleanUp()
*/
private void startMaintenance(Cache<String, QuantizationState> cacheInstance) {
if (maintenanceTask != null) {
maintenanceTask.cancel();
Expand Down

0 comments on commit b135f26

Please sign in to comment.