Skip to content

Commit

Permalink
feat: it is now possible to get the type of a cache implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
QwQ-dev committed Dec 21, 2024
1 parent 658add9 commit ca2b402
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.qwqdev.library.cache.service.caffeine;

import com.github.benmanes.caffeine.cache.AsyncCache;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Supplier;
Expand All @@ -13,6 +15,13 @@
* @since 2024-12-20 20:18
*/
public interface CaffeineAsyncCacheServiceInterface<K, V> {
/**
* Get the {@link AsyncCache} that implements the cache
*
* @return the {@link AsyncCache}
*/
AsyncCache<K, V> getCache();

/**
* Retrieves a value from the cache asynchronously. If the value is not present in the cache,
* it will be fetched using the provided query supplier and optionally cached.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.qwqdev.library.cache.service.caffeine;

import com.github.benmanes.caffeine.cache.Cache;

import java.util.function.Supplier;

/**
Expand All @@ -11,6 +13,13 @@
* @since 2024-12-20 20:18
*/
public interface CaffeineCacheServiceInterface<K, V> {
/**
* Get the {@link Cache} that implements the cache
*
* @return the {@link Cache}
*/
Cache<K, V> getCache();

/**
* Retrieves a value from the cache. If the value is not present in the cache,
* it will be fetched using the provided query supplier and optionally cached.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package me.qwqdev.library.cache.service.memory;

import me.qwqdev.library.cache.model.CacheItem;
import me.qwqdev.library.cache.model.ExpirationSettings;

import java.util.Map;
import java.util.function.Supplier;

/**
Expand All @@ -13,6 +15,13 @@
* @since 2024-12-20 20:39
*/
public interface MemoryCacheServiceInterface<K, V> {
/**
* Get the Map that implements the cache
*
* @return the cache map
*/
Map<K, CacheItem<V>> getCache();

/**
* Retrieves a value from the cache. If the value is not present in the cache,
* it will be fetched using the provided query supplier and optionally cached
Expand Down

0 comments on commit ca2b402

Please sign in to comment.