[ 
https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17286590#comment-17286590
 ] 

ASF GitHub Bot commented on GEODE-8864:
---------------------------------------

jhutchison commented on a change in pull request #5954:
URL: https://github.com/apache/geode/pull/5954#discussion_r578582314



##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/data/RedisHash.java
##########
@@ -46,19 +52,71 @@
 public class RedisHash extends AbstractRedisData {
   public static final RedisHash NULL_REDIS_HASH = new NullRedisHash();
   private HashMap<ByteArrayWrapper, ByteArrayWrapper> hash;
+  private HashMap<UUID, List<ByteArrayWrapper>> hScanSnapShots;
+  private HashMap<UUID, Long> hScanSnapShotCreationTimes;
+  private ScheduledExecutorService HSCANSnapshotExpirationExecutor = null;
+  private int HSCAN_SNAPSHOTS_EXPIRE_MILLISECONDS;
+  private final int TIME_FOR_SNAPSHOTS_TO_LIVE;
+
+
+  public RedisHash(List<ByteArrayWrapper> fieldsToSet, int 
hscanSnapShotExpirationInMillis) {
+    this.hash = new HashMap<>();
+    this.hScanSnapShots = new HashMap<>();
+    this.hScanSnapShotCreationTimes = new HashMap<>();
+    this.HSCAN_SNAPSHOTS_EXPIRE_MILLISECONDS = hscanSnapShotExpirationInMillis;
+    this.TIME_FOR_SNAPSHOTS_TO_LIVE = this.HSCAN_SNAPSHOTS_EXPIRE_MILLISECONDS;
 
-  public RedisHash(List<ByteArrayWrapper> fieldsToSet) {
-    hash = new HashMap<>();
     Iterator<ByteArrayWrapper> iterator = fieldsToSet.iterator();
+
     while (iterator.hasNext()) {
       hashPut(iterator.next(), iterator.next());
     }
   }
 
+  public RedisHash(List<ByteArrayWrapper> fieldsToSet) {
+    this(fieldsToSet, 300000);
+  }
+
+  // for serialization
   public RedisHash() {
-    // for serialization
+    HSCAN_SNAPSHOTS_EXPIRE_MILLISECONDS = 0;
+    this.TIME_FOR_SNAPSHOTS_TO_LIVE = 0;
+  }
+
+  @VisibleForTesting
+  public HashMap<UUID, List<ByteArrayWrapper>> getHscanSnapShots() {
+    return this.hScanSnapShots;
+  }
+
+  private void expireHScanSnapshots() {
+
+    this.hScanSnapShotCreationTimes.entrySet().forEach(entry -> {

Review comment:
       I couldn't decide if the length a snapshot should stick around should be 
different that how often to check if any need to be expired.  I could be 
persuaded that they are the same thing.  I can see situation where a user would 
want to minimize the frequency of the checks, but not want them to stay around 
very long (or vice versa).  for now I renamed them to  
HSCAN_SNAPSHOTS_EXPIRE_CHECK_FREQUENCY_MILLISECONDS and  
MINIMUM_MILLISECONDS_FOR_HSCAN_SNAPSHOTS_TO_LIVE to make the intent more clear. 
 If you feel strongly there should only be one let me know.    I'll add the 
jira.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> finish implementation of Redis HScan Command
> --------------------------------------------
>
>                 Key: GEODE-8864
>                 URL: https://issues.apache.org/jira/browse/GEODE-8864
>             Project: Geode
>          Issue Type: New Feature
>          Components: redis
>            Reporter: John Hutchison
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to