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:
sorry- response on on wrong comment before
----------------------------------------------------------------
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:
[email protected]