Remove Redis and optimize initialization code
This commit is contained in:
parent
1da7eff80e
commit
b46d40b7a3
@ -1,5 +1,6 @@
|
||||
package com.zhangy.skyeye.cache.config;
|
||||
|
||||
import com.zhangy.skyeye.cache.image.ImageJoinTypedCache;
|
||||
import com.zhangy.skyeye.cache.publics.UserTokenTypedCache;
|
||||
import com.zhangy.skyeye.cache.sar.SarTypedCache;
|
||||
import com.zhangy.skyeye.cache.uav.UavTypedCache;
|
||||
@ -31,6 +32,18 @@ public class CacheBeanConfig {
|
||||
return new UserTokenTypedCache(cache);
|
||||
}
|
||||
|
||||
/* ================= IMAGE ================= */
|
||||
@Bean("imageJoinShortNativeCache")
|
||||
public Cache imageJoinShort(CacheManager manager) {
|
||||
return require(manager, "image-join-short");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ImageJoinTypedCache imageJoinShortCache(
|
||||
@Qualifier("imageJoinShortNativeCache") Cache cache) {
|
||||
return new ImageJoinTypedCache(cache);
|
||||
}
|
||||
|
||||
/* ================= SAR ================= */
|
||||
@Bean("sarPermanentNativeCache")
|
||||
public Cache sarPermanent(CacheManager manager) {
|
||||
@ -77,18 +90,6 @@ public class CacheBeanConfig {
|
||||
return new UavTypedCache(cache);
|
||||
}
|
||||
|
||||
/* ================= IMAGE ================= */
|
||||
@Bean("imageJoinNativeCache")
|
||||
public Cache imageJoin(CacheManager manager) {
|
||||
return require(manager, "image-join-short");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserTokenTypedCache imageJoinCache(
|
||||
@Qualifier("imageJoinNativeCache") Cache cache) {
|
||||
return new UserTokenTypedCache(cache);
|
||||
}
|
||||
|
||||
private Cache require(CacheManager manager, String name) {
|
||||
Cache cache = manager.getCache(name);
|
||||
if (cache == null) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.zhangy.skyeye.cache.publics;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user