Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The
CachedTool
is designed to cache results to improve system performance by avoiding redundant computations. It supports different expiration policies to manage cache life cycles efficiently. However, monitoring and handling cache events are crucial to maintain transparency of cache operations.This PR
Introduces Event Handling: Adds new classes within the
CachedToolEvent
sealed interface to handle different cache operation events:Created
is fired when a new cache entry is added.Updated
is triggered when an existing cache entry is updated.Evicted
occurs when an expired cache entry is removed.ExpiredPurged
is sent when all expired entries are purged from the cache.Implements Event Callback:
onCacheEvent
method that can be customized to handle events whenever cache mutations occur.