Selaa lähdekoodia

update redis cache key name

reghao 2 vuotta sitten
vanhempi
commit
362ec071af

+ 3 - 4
dfs-store/src/main/java/cn/reghao/dfs/store/db/repository/ObjectRepository.java

@@ -7,7 +7,6 @@ import cn.reghao.dfs.store.model.po.FileMeta;
 import cn.reghao.oss.api.dto.ObjectMeta;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,17 +41,17 @@ public class ObjectRepository {
     public void update(FileMeta fileMeta) {
     }
 
-    @CacheEvict(cacheNames = "objectMeta", key = "#fileMeta.objectName")
+    @CacheEvict(cacheNames = "oss:store:objectMeta", key = "#fileMeta.objectName")
     public void delete(FileMeta fileMeta) {
     }
 
-    @Cacheable(cacheNames = "fileMeta", key = "#objectName", unless = "#result == null")
+    @Cacheable(cacheNames = "oss:store:fileMeta", key = "#objectName", unless = "#result == null")
     public FileMeta getByObjectName(String objectName) {
         log.info("查找 db");
         return fileMetaMapper.findByObjectName(objectName);
     }
 
-    @Cacheable(cacheNames = "fileMeta", key = "#sha256sum", unless = "#result == null")
+    @Cacheable(cacheNames = "oss:store:fileMeta", key = "#sha256sum", unless = "#result == null")
     public FileMeta getBySha256sum(String sha256sum) {
         return fileMetaMapper.findBySha256sum(sha256sum);
     }