From 7d740e74ea8b9ced9873e480ca86bd0e0e2ae027 Mon Sep 17 00:00:00 2001 From: Jakub Kupsik <101586582+jskupsik@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:45:04 -0800 Subject: [PATCH] Added closure arg types to Cache/CachedValue documentation (#418) --- src/main/groovy/io/xh/hoist/cache/Cache.groovy | 10 ++++++---- .../groovy/io/xh/hoist/cachedvalue/CachedValue.groovy | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/groovy/io/xh/hoist/cache/Cache.groovy b/src/main/groovy/io/xh/hoist/cache/Cache.groovy index 6a3af631..00f90712 100644 --- a/src/main/groovy/io/xh/hoist/cache/Cache.groovy +++ b/src/main/groovy/io/xh/hoist/cache/Cache.groovy @@ -39,17 +39,19 @@ class Cache implements LogSupport { /** Unique name in the context of the service associated with this object. */ public final String name - /** Closure to determine if an entry should be expired (optional). */ + /** + * Closure { CacheEntry -> Boolean } to determine if an entry should be expired (optional). + */ public final Closure expireFn /** - * Entry TTL as epochMillis Long, or closure to return the same (optional). + * Entry TTL as epochMillis Long, or closure { void -> Long } to return the same (optional). * No effect if a custom expireFn is provided instead. If both null, entries will never expire. */ public final Object expireTime /** - * Closure to determine the timestamp of an entry (optional). + * Closure { V -> Long | Date | Instant } to determine the timestamp of an entry (optional). * Must return a Long (as epochMillis), Date, or Instant. */ public final Closure timestampFn @@ -57,7 +59,7 @@ class Cache implements LogSupport { /** True to replicate this cache across a cluster (default false). */ public final boolean replicate - /** Handlers to be called on change with a {@link CacheEntryChanged} */ + /** Handler closures { CacheEntryChanged -> void } to be called on change. */ public final List onChange = [] /** diff --git a/src/main/groovy/io/xh/hoist/cachedvalue/CachedValue.groovy b/src/main/groovy/io/xh/hoist/cachedvalue/CachedValue.groovy index d4d76529..2edbdbee 100644 --- a/src/main/groovy/io/xh/hoist/cachedvalue/CachedValue.groovy +++ b/src/main/groovy/io/xh/hoist/cachedvalue/CachedValue.groovy @@ -33,17 +33,20 @@ class CachedValue implements LogSupport { /** Unique name in the context of the service associated with this object. */ public final String name - /** Closure to determine if an entry should be expired (optional). */ + /** + * Closure { CachedValueEntry -> Boolean } to determine if an entry should + * be expired (optional). + */ public final Closure expireFn /** - * Entry TTL as epochMillis Long, or closure to return the same (optional). + * Entry TTL as epochMillis Long, or closure { void -> Long } to return the same (optional). * No effect if a custom expireFn is provided instead. If both null, entries will never expire. */ public final Object expireTime /** - * Closure to determine the timestamp of an entry (optional). + * Closure { V -> Long | Date | Instant } to determine the timestamp of an entry (optional). * Must return a Long (as epochMillis), Date, or Instant. */ public final Closure timestampFn @@ -51,7 +54,7 @@ class CachedValue implements LogSupport { /** True to replicate this cache across a cluster (default false). */ public final boolean replicate - /** Handlers to be called on change with a {@link CachedValueChanged} object. */ + /** Handler closures { CachedValueChanged -> void } to be called on change. */ public final List onChange = []