You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2021/03/16 18:54:47 UTC
[geode] 14/36: HACK - short circuit RedisString.get call to use
getValueInVM
This is an automated email from the ASF dual-hosted git repository.
upthewaterspout pushed a commit to branch feature/redis-performance-testing
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 77aff20d4e1eb054278ab908a75e9c98619524bb
Author: Jens Deppe <jd...@vmware.com>
AuthorDate: Thu Feb 25 15:39:25 2021 -0800
HACK - short circuit RedisString.get call to use getValueInVM
---
.../string/RedisStringCommandsFunctionInvoker.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/RedisStringCommandsFunctionInvoker.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/RedisStringCommandsFunctionInvoker.java
index 79b6cd2..1e5606b 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/RedisStringCommandsFunctionInvoker.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/RedisStringCommandsFunctionInvoker.java
@@ -36,10 +36,14 @@ import static org.apache.geode.redis.internal.RedisCommandType.STRLEN;
import java.math.BigDecimal;
import java.util.List;
+import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.Region;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.VMCachedDeserializable;
import org.apache.geode.redis.internal.data.ByteArrayWrapper;
import org.apache.geode.redis.internal.data.RedisData;
import org.apache.geode.redis.internal.data.RedisKey;
+import org.apache.geode.redis.internal.data.RedisString;
import org.apache.geode.redis.internal.executor.RedisCommandsFunctionInvoker;
/**
@@ -61,6 +65,17 @@ public class RedisStringCommandsFunctionInvoker extends RedisCommandsFunctionInv
@Override
public ByteArrayWrapper get(RedisKey key) {
+ Object v = null;
+ try {
+ v = ((PartitionedRegion) region).getValueInVM(key);
+ } catch (EntryNotFoundException ignored) {
+ }
+
+ if (v != null) {
+ Object cached = ((VMCachedDeserializable) v).getDeserializedForReading();
+ return ((RedisString) cached).get();
+ }
+
return invokeCommandFunction(key, GET);
}