diff --git a/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineAsyncCacheServiceFactory.java b/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineAsyncCacheServiceFactory.java index d723245..90d84bc 100644 --- a/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineAsyncCacheServiceFactory.java +++ b/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineAsyncCacheServiceFactory.java @@ -1,6 +1,7 @@ package me.qwqdev.library.cache.factory; import com.github.benmanes.caffeine.cache.AsyncCache; +import lombok.experimental.UtilityClass; import me.qwqdev.library.cache.service.caffeine.CaffeineAsyncCacheService; import me.qwqdev.library.cache.service.caffeine.CaffeineAsyncCacheServiceInterface; @@ -10,6 +11,7 @@ * @author qwq-dev * @since 2024-12-20 20:39 */ +@UtilityClass public class CaffeineAsyncCacheServiceFactory { /** * Creates a new instance of {@link CaffeineAsyncCacheService} with a default {@link AsyncCache}. diff --git a/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineCacheServiceFactory.java b/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineCacheServiceFactory.java index d4d4139..a934e65 100644 --- a/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineCacheServiceFactory.java +++ b/cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineCacheServiceFactory.java @@ -1,6 +1,7 @@ package me.qwqdev.library.cache.factory; import com.github.benmanes.caffeine.cache.Cache; +import lombok.experimental.UtilityClass; import me.qwqdev.library.cache.service.caffeine.CaffeineCacheService; import me.qwqdev.library.cache.service.caffeine.CaffeineCacheServiceInterface; @@ -10,6 +11,7 @@ * @author qwq-dev * @since 2024-12-20 20:39 */ +@UtilityClass public class CaffeineCacheServiceFactory { /** * Creates a new instance of {@link CaffeineCacheService} with a default {@link Cache}. diff --git a/cache/src/main/java/me/qwqdev/library/cache/factory/MemoryCacheServiceFactory.java b/cache/src/main/java/me/qwqdev/library/cache/factory/MemoryCacheServiceFactory.java index 5936b5e..bb7e0c0 100644 --- a/cache/src/main/java/me/qwqdev/library/cache/factory/MemoryCacheServiceFactory.java +++ b/cache/src/main/java/me/qwqdev/library/cache/factory/MemoryCacheServiceFactory.java @@ -1,5 +1,6 @@ package me.qwqdev.library.cache.factory; +import lombok.experimental.UtilityClass; import me.qwqdev.library.cache.model.CacheItem; import me.qwqdev.library.cache.service.memory.MemoryCacheService; import me.qwqdev.library.cache.service.memory.MemoryCacheServiceInterface; @@ -13,6 +14,7 @@ * @author qwq-dev * @since 2024-12-20 20:39 */ +@UtilityClass public class MemoryCacheServiceFactory { /** * Creates a new instance of {@link MemoryCacheService} with a default {@link ConcurrentHashMap}. diff --git a/cache/src/main/java/me/qwqdev/library/cache/factory/RedisCacheServiceFactory.java b/cache/src/main/java/me/qwqdev/library/cache/factory/RedisCacheServiceFactory.java new file mode 100644 index 0000000..c83385a --- /dev/null +++ b/cache/src/main/java/me/qwqdev/library/cache/factory/RedisCacheServiceFactory.java @@ -0,0 +1,26 @@ +package me.qwqdev.library.cache.factory; + +import lombok.experimental.UtilityClass; +import me.qwqdev.library.cache.service.redis.RedisCacheService; +import me.qwqdev.library.cache.service.redis.RedisCacheServiceInterface; +import org.redisson.config.Config; + +/** + * Factory class for creating instances of {@link RedisCacheService}. + * + * @author qwq-dev + * @since 2024-12-21 12:27 + */ +@UtilityClass +public class RedisCacheServiceFactory { + /** + * Creates a new instance of {@link RedisCacheService} with a default {@link RedisCacheService}. + * + * @param the type of the key + * @param the type of the value + * @return a new instance of {@link RedisCacheService} + */ + public static RedisCacheServiceInterface create(Config config) { + return new RedisCacheService<>(config); + } +}