diff --git a/opsli-plugins/opsli-plugins-crypto/src/main/java/opsli/plugins/crypto/strategy/impl/CryptoAsymmetricAsymmetricImpl.java b/opsli-plugins/opsli-plugins-crypto/src/main/java/opsli/plugins/crypto/strategy/impl/CryptoAsymmetricAsymmetricImpl.java index 9f0a9833..05a14b48 100644 --- a/opsli-plugins/opsli-plugins-crypto/src/main/java/opsli/plugins/crypto/strategy/impl/CryptoAsymmetricAsymmetricImpl.java +++ b/opsli-plugins/opsli-plugins-crypto/src/main/java/opsli/plugins/crypto/strategy/impl/CryptoAsymmetricAsymmetricImpl.java @@ -57,21 +57,13 @@ public class CryptoAsymmetricAsymmetricImpl implements CryptoAsymmetricService { static{ // 初始化缓存类对象 LFU_CACHE_MAP = Maps.newConcurrentMap(); - LFU_CACHE_MAP.put(CryptoAsymmetricType.RSA, - CacheBuilder - .newBuilder().maximumSize(DEFAULT_CACHE_COUNT) - .expireAfterWrite(DEFAULT_CACHE_TIME, TimeUnit.MINUTES).build() - ); - LFU_CACHE_MAP.put(CryptoAsymmetricType.SM2, - CacheBuilder - .newBuilder().maximumSize(DEFAULT_CACHE_COUNT) - .expireAfterWrite(DEFAULT_CACHE_TIME, TimeUnit.MINUTES).build() - ); - LFU_CACHE_MAP.put(CryptoAsymmetricType.ECIES, - CacheBuilder - .newBuilder().maximumSize(DEFAULT_CACHE_COUNT) - .expireAfterWrite(DEFAULT_CACHE_TIME, TimeUnit.MINUTES).build() - ); + for (CryptoAsymmetricType asymmetricType : CryptoAsymmetricType.values()) { + LFU_CACHE_MAP.put(asymmetricType, + CacheBuilder + .newBuilder().maximumSize(DEFAULT_CACHE_COUNT) + .expireAfterWrite(DEFAULT_CACHE_TIME, TimeUnit.MINUTES).build() + ); + } } /**