1. 集羣式緩存 2. 支持註解緩存 2. 緩存定時自動更新 3. 可支持單機緩存部署 4. 可支持手動緩存 5. 管理界面*
考慮用J2CACHE,加上spring cache支持註解
https://apidoc.gitee.com/ld/J2Cache/
註解 | param | 示例 |
---|---|---|
@Cacheable | cacheNames 模塊名,value 命名空間,key 惟一key,condition 哪一種狀況下才緩存結果 | @Cacheable(value = "models", key = "#testModel.name", condition = "#testModel.address != '' ") |
@CacheEvict | cacheNames 模塊名,value 命名空間 ,allEntries 標記是否刪除命名空間下,key | @CacheEvict(value = "models", allEntries = true) |
@CachePut | cacheNames 模塊名,value 命名空間,key | @CachePut(value = "models", key = "#name") |
結合@Scheduled(fixedDelay=任務間的延時時間,fixedRate=任務的間隔時間,cron=表達式)使用git
示例:spring
@Cacheable(cacheNames="test",key="name") @Schedule(fixedDelay=2000) public String getCache(String key){ return "test"; }