From d968e15e315f3ba8cd93bfa53eae7e4159538198 Mon Sep 17 00:00:00 2001 From: hoelee Date: Tue, 8 Nov 2022 18:27:00 +0800 Subject: [PATCH] feat(java-cache): add --- .../hoelee/platform/cache/CacheProperties.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 platform/java-cache/src/main/java/com/hoelee/platform/cache/CacheProperties.java diff --git a/platform/java-cache/src/main/java/com/hoelee/platform/cache/CacheProperties.java b/platform/java-cache/src/main/java/com/hoelee/platform/cache/CacheProperties.java new file mode 100644 index 00000000..3d00ba31 --- /dev/null +++ b/platform/java-cache/src/main/java/com/hoelee/platform/cache/CacheProperties.java @@ -0,0 +1,18 @@ +package com.hoelee.platform.cache; + +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import java.time.Duration; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +/** + * @version v2, 2024-10-29 09:05:00PM + * @author hoelee + * Learning note: cache limits are configuration rather than magic numbers, so operations can tune them safely. + */ +@Validated +@ConfigurationProperties(prefix = "app.cache") +public record CacheProperties(@Min(1) int maximumSize, @NotNull Duration ttl) { +} +