Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CachedTool: Event Handling #793

Merged
merged 1 commit into from
Oct 10, 2024
Merged

CachedTool: Event Handling #793

merged 1 commit into from
Oct 10, 2024

Conversation

realdavidvega
Copy link
Contributor

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:

    • Introduces an overridable onCacheEvent method that can be customized to handle events whenever cache mutations occur.

@realdavidvega realdavidvega merged commit 963ea04 into main Oct 10, 2024
6 checks passed
@realdavidvega realdavidvega deleted the feature/cache-events branch October 10, 2024 08:10
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