rishabhdaim commented on code in PR #2843:
URL: https://github.com/apache/jackrabbit-oak/pull/2843#discussion_r3073118279


##########
oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/api/CacheBuilder.java:
##########
@@ -186,6 +188,18 @@ public CacheBuilder<K, V> ticker(@NotNull Supplier<Long> 
ticker) {
         return this;
     }
 
+    /**
+     * Sets the clock used to measure time for expiry and refresh.
+     * Convenience overload for {@link #ticker(Supplier)}; converts 
milliseconds to nanoseconds internally.
+     *
+     * @param clock the clock to use (must not be null)
+     * @return this builder
+     */
+    @NotNull
+    public CacheBuilder<K, V> ticker(@NotNull Clock clock) {
+        return ticker(() -> TimeUnit.MILLISECONDS.toNanos(clock.millis()));
+    }

Review Comment:
   It's a new API in `CacheBuilder` suggested by @jsedding in the last pull 
request.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to