From 04dae4dbf9dd9c3589c7357f078b8cc157dfe6b0 Mon Sep 17 00:00:00 2001 From: hiparker Date: Tue, 18 May 2021 18:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=9D=9E=E5=AF=B9?= =?UTF-8?q?=E7=A7=B0=E5=8A=A0=E5=AF=86=2060%(=E6=9C=AA=E5=AE=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CryptoAsymmetricAsymmetricImpl.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) 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 9f0a983..05a14b4 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() + ); + } } /**