!243 解决定时清除缓存时,对于多媒体类型文件,只删除了磁盘缓存文件,导致再次预览时从缓存中获取到了一个不存在文件路径
Merge pull request !243 from zhh/master
This commit is contained in:
@ -101,6 +101,7 @@ public class CacheServiceJDKImpl implements CacheService {
|
||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
||||
initMediaConvertCachePool(CacheService.DEFAULT_MEDIACONVERT_CAPACITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -107,6 +107,7 @@ public class CacheServiceRedisImpl implements CacheService {
|
||||
cleanPdfCache();
|
||||
cleanImgCache();
|
||||
cleanPdfImgCache();
|
||||
cleanMediaConvertCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,4 +136,9 @@ public class CacheServiceRedisImpl implements CacheService {
|
||||
RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
|
||||
pdfImg.clear();
|
||||
}
|
||||
|
||||
private void cleanMediaConvertCache() {
|
||||
RMapCache<String, Integer> mediaConvertCache = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
|
||||
mediaConvertCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,6 +218,7 @@ public class CacheServiceRocksDBImpl implements CacheService {
|
||||
cleanPdfCache();
|
||||
cleanImgCache();
|
||||
cleanPdfImgCache();
|
||||
cleanMediaConvertCache();
|
||||
} catch (IOException | RocksDBException e) {
|
||||
LOGGER.error("Clean Cache Exception" + e);
|
||||
}
|
||||
@ -281,4 +282,9 @@ public class CacheServiceRocksDBImpl implements CacheService {
|
||||
Map<String, Integer> initPDFIMGCache = new HashMap<>();
|
||||
db.put(FILE_PREVIEW_PDF_IMGS_KEY.getBytes(), toByteArray(initPDFIMGCache));
|
||||
}
|
||||
|
||||
private void cleanMediaConvertCache() throws IOException, RocksDBException {
|
||||
Map<String, String> initMediaConvertCache = new HashMap<>();
|
||||
db.put(FILE_PREVIEW_MEDIA_CONVERT_KEY.getBytes(), toByteArray(initMediaConvertCache));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user