diff --git a/docs/cache-api-implementations.md b/docs/cache-api-implementations.md index 637e25542..2b64b8580 100644 --- a/docs/cache-api-implementations.md +++ b/docs/cache-api-implementations.md @@ -498,15 +498,19 @@ Below is the complete list of available managers: // NONE - No synchronizations on map changes .syncStrategy(SyncStrategy.INVALIDATE) - // time to live for each map entry in local cache - .timeToLive(10000) - // or - .timeToLive(10, TimeUnit.SECONDS) - - // max idle time for each map entry in local cache - .maxIdle(10000) - // or - .maxIdle(10, TimeUnit.SECONDS); + // time to live for each entry in local cache + .timeToLive(Duration.ofSeconds(10)) + + // max idle time for each entry in local cache + .maxIdle(Duration.ofSeconds(10)); + + // Defines how to listen expired event sent by Redis or Valkey upon this instance deletion + // + // Follow expiration policies are available: + // DONT_SUBSCRIBE - Don't subscribe on expire event + // SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using `__keyevent@*:expired` pattern + // SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using `__keyspace@N__:name` channel + .expirationEventPolicy(ExpirationEventPolicy.SUBSCRIBE_WITH_KEYEVENT_PATTERN) ``` Usage example: @@ -614,15 +618,19 @@ Cache cache = manager.createCache("namedCache", rConfig); // NONE - No synchronizations on map changes .syncStrategy(SyncStrategy.INVALIDATE) - // time to live for each map entry in local cache - .timeToLive(10000) - // or - .timeToLive(10, TimeUnit.SECONDS) + // time to live for each entry in local cache + .timeToLive(Duration.ofSeconds(10)) - // max idle time for each map entry in local cache - .maxIdle(10000) - // or - .maxIdle(10, TimeUnit.SECONDS); + // max idle time for each entry in local cache + .maxIdle(Duration.ofSeconds(10)); + + // Defines how to listen expired event sent by Redis or Valkey upon this instance deletion + // + // Follow expiration policies are available: + // DONT_SUBSCRIBE - Don't subscribe on expire event + // SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using `__keyevent@*:expired` pattern + // SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using `__keyspace@N__:name` channel + .expirationEventPolicy(ExpirationEventPolicy.SUBSCRIBE_WITH_KEYEVENT_PATTERN) ``` Usage examples: diff --git a/docs/cache/spring-cache.md b/docs/cache/spring-cache.md index e31691b6c..ebc4bdc74 100644 --- a/docs/cache/spring-cache.md +++ b/docs/cache/spring-cache.md @@ -151,15 +151,20 @@ LocalCachedMapOptions options = LocalCachedMapOptions.defaults() // NONE - No synchronizations on map changes .syncStrategy(SyncStrategy.INVALIDATE) - // time to live for each map entry in local cache -.timeToLive(10000) - // or -.timeToLive(10, TimeUnit.SECONDS) - - // max idle time for each map entry in local cache -.maxIdle(10000) - // or -.maxIdle(10, TimeUnit.SECONDS); +// time to live for each entry in local cache +.timeToLive(Duration.ofSeconds(10)) + +// max idle time for each entry in local cache +.maxIdle(Duration.ofSeconds(10)); + +// Defines how to listen expired event sent by Redis or Valkey upon this instance deletion +// +// Follow expiration policies are available: +// DONT_SUBSCRIBE - Don't subscribe on expire event +// SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using `__keyevent@*:expired` pattern +// SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using `__keyspace@N__:name` channel +.expirationEventPolicy(ExpirationEventPolicy.SUBSCRIBE_WITH_KEYEVENT_PATTERN) + ``` Each Spring Cache instance has two important parameters: `ttl` and `maxIdleTime` and stores data infinitely if they are not defined or equal to `0`. diff --git a/docs/data-and-services/collections.md b/docs/data-and-services/collections.md index 77fddbd90..da9bf04b7 100644 --- a/docs/data-and-services/collections.md +++ b/docs/data-and-services/collections.md @@ -212,15 +212,19 @@ Follow options can be supplied during object creation: // NONE - No synchronizations on map changes .syncStrategy(SyncStrategy.INVALIDATE) - // time to live for each map entry in local cache - .timeToLive(10000) - // or - .timeToLive(10, TimeUnit.SECONDS) + // time to live for each entry in local cache + .timeToLive(Duration.ofSeconds(10)) // max idle time for each map entry in local cache - .maxIdle(10000) - // or - .maxIdle(10, TimeUnit.SECONDS); + .maxIdle(Duration.ofSeconds(10)) + + // Defines how to listen expired event sent by Redis or Valkey upon this instance deletion + // + // Follow expiration policies are available: + // DONT_SUBSCRIBE - Don't subscribe on expire event + // SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using `__keyevent@*:expired` pattern + // SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using `__keyspace@N__:name` channel + .expirationEventPolicy(ExpirationEventPolicy.SUBSCRIBE_WITH_KEYEVENT_PATTERN); ``` Code example: @@ -836,8 +840,8 @@ Follow options can be supplied during object creation: // // Follow expiration policies are available: // DONT_SUBSCRIBE - Don't subscribe on expire event - // SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using __keyevent@*:expired pattern - // SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using __keyspace@N__:name channel + // SUBSCRIBE_WITH_KEYEVENT_PATTERN - Subscribe on expire event using `__keyevent@*:expired` pattern + // SUBSCRIBE_WITH_KEYSPACE_CHANNEL - Subscribe on expire event using `__keyspace@N__:name` channel .expirationEventPolicy(ExpirationEventPolicy.SUBSCRIBE_WITH_KEYEVENT_PATTERN) ```