-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
实现 caffeine 的 cache 接口,提供 getAll, putAll, invalidateAll 批处理功能
- Loading branch information
1 parent
78d709a
commit 5b63f92
Showing
11 changed files
with
465 additions
and
26 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/com/pig4cloud/plugin/cache/enums/CacheOperation.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,18 @@ | ||
package com.pig4cloud.plugin.cache.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
@JsonFormat(shape = JsonFormat.Shape.NUMBER) | ||
public enum CacheOperation { | ||
|
||
/** | ||
* 清除 key | ||
*/ | ||
EVICT, | ||
|
||
/** | ||
* 批量清除 | ||
*/ | ||
EVICT_BATCH | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/pig4cloud/plugin/cache/support/CacheManager.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,14 @@ | ||
package com.pig4cloud.plugin.cache.support; | ||
|
||
import com.github.benmanes.caffeine.cache.Cache; | ||
|
||
public interface CacheManager extends org.springframework.cache.CacheManager { | ||
|
||
/** | ||
* 实现 caffeine 的 {@link Cache} 接口的缓存 | ||
* @param name 缓存名 | ||
* @return {@link Cache} 的实现 | ||
*/ | ||
<K, V> Cache<K, V> getCaffeineCache(String name); | ||
|
||
} |
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
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
Oops, something went wrong.