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