-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Automatic lock processing, overall reconstruction.
- Loading branch information
Showing
20 changed files
with
651 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
@FairyLaunch | ||
@InjectableComponent | ||
public class CacheLauncher extends Plugin { | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
cache/src/main/java/me/qwqdev/library/cache/factory/CacheServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package me.qwqdev.library.cache.factory; | ||
|
||
import com.github.benmanes.caffeine.cache.AsyncCache; | ||
import com.github.benmanes.caffeine.cache.Cache; | ||
import lombok.experimental.UtilityClass; | ||
import me.qwqdev.library.cache.service.CacheServiceInterface; | ||
import me.qwqdev.library.cache.service.caffeine.CaffeineAsyncCacheService; | ||
import me.qwqdev.library.cache.service.caffeine.CaffeineCacheService; | ||
import me.qwqdev.library.cache.service.redis.RedisCacheService; | ||
import me.qwqdev.library.cache.service.redis.RedisCacheServiceInterface; | ||
import org.redisson.config.Config; | ||
|
||
/** | ||
* Factory for creating cache service instances. | ||
* | ||
* <p>Provides centralized creation of different cache implementations | ||
* with various configuration options. | ||
* | ||
* @author qwq-dev | ||
* @since 2024-12-21 20:10 | ||
*/ | ||
@UtilityClass | ||
public final class CacheServiceFactory { | ||
/** | ||
* Creates a Redis cache service with the specified configuration. | ||
* | ||
* @param config the Redis configuration | ||
* @return a new Redis cache service instance | ||
*/ | ||
public static RedisCacheServiceInterface createRedisCache(Config config) { | ||
return new RedisCacheService(config); | ||
} | ||
|
||
/** | ||
* Creates a Caffeine synchronous cache service with custom configuration. | ||
* | ||
* @param cache the Caffeine cache | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @return a new Caffeine cache service instance | ||
*/ | ||
public static <K, V> CacheServiceInterface<Cache<K, V>, V> createCaffeineCache(Cache<K, V> cache) { | ||
return new CaffeineCacheService<>(cache); | ||
} | ||
|
||
/** | ||
* Creates a Caffeine synchronous cache service with default configuration. | ||
* | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @return a new Caffeine cache service instance | ||
*/ | ||
public static <K, V> CacheServiceInterface<Cache<K, V>, V> createCaffeineCache() { | ||
return new CaffeineCacheService<>(); | ||
} | ||
|
||
/** | ||
* Creates a Caffeine asynchronous cache service with custom configuration. | ||
* | ||
* @param asyncCache the Caffeine async cache | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @return a new async Caffeine cache service instance | ||
*/ | ||
public static <K, V> CacheServiceInterface<AsyncCache<K, V>, V> createCaffeineAsyncCache(AsyncCache<K, V> asyncCache) { | ||
return new CaffeineAsyncCacheService<>(asyncCache); | ||
} | ||
|
||
/** | ||
* Creates a Caffeine asynchronous cache service with default configuration. | ||
* | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @return a new async Caffeine cache service instance | ||
*/ | ||
public static <K, V> CacheServiceInterface<AsyncCache<K, V>, V> createCaffeineAsyncCache() { | ||
return new CaffeineAsyncCacheService<>(); | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineAsyncCacheServiceFactory.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
cache/src/main/java/me/qwqdev/library/cache/factory/CaffeineCacheServiceFactory.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
cache/src/main/java/me/qwqdev/library/cache/factory/MemoryCacheServiceFactory.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.