Add Caffeine cache utility and coroutine scheduling functions#313
Merged
twisti-dev merged 6 commits intoversion/26.1from Apr 18, 2026
Merged
Add Caffeine cache utility and coroutine scheduling functions#313twisti-dev merged 6 commits intoversion/26.1from
twisti-dev merged 6 commits intoversion/26.1from
Conversation
- introduce withAutoCloseOnRemoval extension for Caffeine cache builder - ensure AutoCloseable keys and values are closed on removal - add error handling and logging for removal and close operations
- document behavior, parameters, and return value of withAutoCloseOnRemoval extension - clarify auto-close logic and exception handling in removal listener
…ed delay, and conditional loops - introduce runAtFixedRate for scheduling coroutines at a fixed interval - add runWithFixedDelay for repeated execution with a fixed delay between runs - implement runUntil for conditional repeated execution with delay and predicate - include kdoc for all new coroutine utility functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces new utility functions for cache management and coroutine scheduling, and bumps the project version to 3.2.0. The most significant changes are the addition of utilities for Caffeine cache auto-closing and advanced coroutine scheduling helpers, which will help manage resources and periodic tasks more safely and conveniently.
New utility features:
withAutoCloseOnRemovalextension function forCaffeinecaches incaffeine-util.kt, allowing automatic closing of keys and values that implementAutoCloseablewhen they are removed from the cache, with error handling and optional custom removal listener.coroutine-util.kt:runAtFixedRate: runs a suspending block at a fixed rate, regardless of execution time.runWithFixedDelay: runs a suspending block with a fixed delay after each execution.runUntil: runs a suspending block repeatedly with a delay, stopping when a predicate returns false.API surface updates:
surf-api-core.apifor the new cache and coroutine utilities.Project metadata:
gradle.properties.