Skip to content

Commit

Permalink
feat: factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
QwQ-dev committed Dec 21, 2024
1 parent 232851a commit 638afbd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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}.
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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}.
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <K> the type of the key
* @param <V> the type of the value
* @return a new instance of {@link RedisCacheService}
*/
public static <K, V> RedisCacheServiceInterface<K, V> create(Config config) {
return new RedisCacheService<>(config);
}
}

0 comments on commit 638afbd

Please sign in to comment.