From c627ab05e28558573833f5431b4c2cc5b1040667 Mon Sep 17 00:00:00 2001 From: Samuel Fu Date: Tue, 3 Sep 2024 09:01:18 -0700 Subject: [PATCH 1/4] Removed isJsonString check in EVCacheSerializingTranscoder --- .../java/com/netflix/evcache/EVCacheSerializingTranscoder.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/evcache-core/src/main/java/com/netflix/evcache/EVCacheSerializingTranscoder.java b/evcache-core/src/main/java/com/netflix/evcache/EVCacheSerializingTranscoder.java index 599387cd..0235b81b 100644 --- a/evcache-core/src/main/java/com/netflix/evcache/EVCacheSerializingTranscoder.java +++ b/evcache-core/src/main/java/com/netflix/evcache/EVCacheSerializingTranscoder.java @@ -149,9 +149,6 @@ public CachedData encode(Object o) { int flags = 0; if (o instanceof String) { b = encodeString((String) o); - if (StringUtils.isJsonObject((String) o)) { - return new CachedData(flags, b, getMaxSize()); - } } else if (o instanceof Long) { b = tu.encodeLong((Long) o); flags |= SPECIAL_LONG; From dc09d42ae7b6aa7383b4d180e820c2e75a4e4744 Mon Sep 17 00:00:00 2001 From: Patrick Strawderman Date: Sun, 29 Sep 2024 12:46:55 -0700 Subject: [PATCH 2/4] Fix build issues related to missing grgit-core artifact Force grgit-core to 4.1.1 to resolve build issues. This is a temporary workaround, the ideal solution is to move the project to the latest gradle and netflixoss plugin versions, but that is a larget undertaking. --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 9cf74125..842809cd 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,11 @@ buildscript { repositories { mavenCentral() } + configurations.all { + resolutionStrategy { + force 'org.ajoberstar.grgit:grgit-core:4.1.1' + } + } } plugins { From 89d57e102479b70761eb9c1cd35c9bc97ff854d6 Mon Sep 17 00:00:00 2001 From: Asi Bross <11426802+asibross@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:51:34 -0700 Subject: [PATCH 3/4] When the EVCacheImpl cacheName is an empty string it should have the same behavior as null --- .../main/java/com/netflix/evcache/EVCacheImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java b/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java index b17450b3..dca558fd 100644 --- a/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java +++ b/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java @@ -30,6 +30,7 @@ import com.netflix.evcache.util.KeyHasher; import com.netflix.evcache.util.RetryCount; import com.netflix.evcache.util.Sneaky; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -119,7 +120,7 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { this._appName = appName; this._cacheName = cacheName; - if(_cacheName != null && _cacheName.length() > 0) { + if(StringUtils.isNotEmpty(_cacheName)) { for(int i = 0; i < cacheName.length(); i++) { if(Character.isWhitespace(cacheName.charAt(i))){ throw new IllegalArgumentException("Cache Prefix ``" + cacheName + "`` contains invalid character at position " + i ); @@ -134,9 +135,11 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { tags = new ArrayList(3); EVCacheMetricsFactory.getInstance().addAppNameTags(tags, _appName); - if(_cacheName != null && _cacheName.length() > 0) tags.add(new BasicTag(EVCacheMetricsFactory.PREFIX, _cacheName)); + if(StringUtils.isNotEmpty(_cacheName)) { + tags.add(new BasicTag(EVCacheMetricsFactory.PREFIX, _cacheName)); + } - final String _metricName = (_cacheName == null) ? _appName : _appName + "." + _cacheName; + final String _metricName = StringUtils.isEmpty(_cacheName) ? _appName : _appName + "." + _cacheName; _metricPrefix = _appName + "-"; this._poolManager = poolManager; this._pool = poolManager.getEVCacheClientPool(_appName); @@ -145,7 +148,7 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { _zoneFallbackFP = propertyRepository.get(_metricName + ".fallback.zone", Boolean.class).orElseGet(_appName + ".fallback.zone").orElse(true); _bulkZoneFallbackFP = propertyRepository.get(_appName + ".bulk.fallback.zone", Boolean.class).orElse(true); _bulkPartialZoneFallbackFP = propertyRepository.get(_appName+ ".bulk.partial.fallback.zone", Boolean.class).orElse(true); - if(_cacheName == null) { + if(StringUtils.isEmpty(_cacheName)) { _useInMemoryCache = propertyRepository.get(_appName + ".use.inmemory.cache", Boolean.class).orElseGet("evcache.use.inmemory.cache").orElse(false); } else { _useInMemoryCache = propertyRepository.get(_appName + "." + _cacheName + ".use.inmemory.cache", Boolean.class).orElseGet(_appName + ".use.inmemory.cache").orElseGet("evcache.use.inmemory.cache").orElse(false); @@ -207,7 +210,7 @@ EVCacheKey getEVCacheKey(final String key) { } final String canonicalKey; - if (this._cacheName == null) { + if (StringUtils.isEmpty(this._cacheName)) { canonicalKey = key; } else { final int keyLength = _cacheName.length() + 1 + key.length(); From 9840da23e24e9986f54210887c6cb818a0ac37eb Mon Sep 17 00:00:00 2001 From: srrangarajan Date: Fri, 18 Oct 2024 14:12:59 -0700 Subject: [PATCH 4/4] =?UTF-8?q?Revert=20"When=20the=20EVCacheImpl=20cacheN?= =?UTF-8?q?ame=20is=20an=20empty=20string=20it=20should=20have=20the=20?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/netflix/evcache/EVCacheImpl.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java b/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java index dca558fd..b17450b3 100644 --- a/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java +++ b/evcache-core/src/main/java/com/netflix/evcache/EVCacheImpl.java @@ -30,7 +30,6 @@ import com.netflix.evcache.util.KeyHasher; import com.netflix.evcache.util.RetryCount; import com.netflix.evcache.util.Sneaky; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -120,7 +119,7 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { this._appName = appName; this._cacheName = cacheName; - if(StringUtils.isNotEmpty(_cacheName)) { + if(_cacheName != null && _cacheName.length() > 0) { for(int i = 0; i < cacheName.length(); i++) { if(Character.isWhitespace(cacheName.charAt(i))){ throw new IllegalArgumentException("Cache Prefix ``" + cacheName + "`` contains invalid character at position " + i ); @@ -135,11 +134,9 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { tags = new ArrayList(3); EVCacheMetricsFactory.getInstance().addAppNameTags(tags, _appName); - if(StringUtils.isNotEmpty(_cacheName)) { - tags.add(new BasicTag(EVCacheMetricsFactory.PREFIX, _cacheName)); - } + if(_cacheName != null && _cacheName.length() > 0) tags.add(new BasicTag(EVCacheMetricsFactory.PREFIX, _cacheName)); - final String _metricName = StringUtils.isEmpty(_cacheName) ? _appName : _appName + "." + _cacheName; + final String _metricName = (_cacheName == null) ? _appName : _appName + "." + _cacheName; _metricPrefix = _appName + "-"; this._poolManager = poolManager; this._pool = poolManager.getEVCacheClientPool(_appName); @@ -148,7 +145,7 @@ public class EVCacheImpl implements EVCache, EVCacheImplMBean { _zoneFallbackFP = propertyRepository.get(_metricName + ".fallback.zone", Boolean.class).orElseGet(_appName + ".fallback.zone").orElse(true); _bulkZoneFallbackFP = propertyRepository.get(_appName + ".bulk.fallback.zone", Boolean.class).orElse(true); _bulkPartialZoneFallbackFP = propertyRepository.get(_appName+ ".bulk.partial.fallback.zone", Boolean.class).orElse(true); - if(StringUtils.isEmpty(_cacheName)) { + if(_cacheName == null) { _useInMemoryCache = propertyRepository.get(_appName + ".use.inmemory.cache", Boolean.class).orElseGet("evcache.use.inmemory.cache").orElse(false); } else { _useInMemoryCache = propertyRepository.get(_appName + "." + _cacheName + ".use.inmemory.cache", Boolean.class).orElseGet(_appName + ".use.inmemory.cache").orElseGet("evcache.use.inmemory.cache").orElse(false); @@ -210,7 +207,7 @@ EVCacheKey getEVCacheKey(final String key) { } final String canonicalKey; - if (StringUtils.isEmpty(this._cacheName)) { + if (this._cacheName == null) { canonicalKey = key; } else { final int keyLength = _cacheName.length() + 1 + key.length();