[ https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295389#comment-17295389 ]
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_r587614479 ########## File path: geode-redis/src/main/java/org/apache/geode/redis/internal/data/RedisHash.java ########## @@ -46,19 +53,88 @@ public class RedisHash extends AbstractRedisData { public static final RedisHash NULL_REDIS_HASH = new NullRedisHash(); private HashMap<ByteArrayWrapper, ByteArrayWrapper> hash; + private ConcurrentHashMap<UUID, List<ByteArrayWrapper>> hScanSnapShots; + private ConcurrentHashMap<UUID, Long> hScanSnapShotCreationTimes; + private ScheduledExecutorService HSCANSnapshotExpirationExecutor = null; + + private static int default_hscan_snapshots_expire_check_frequency = + Integer.getInteger("redis.hscan-snapshot-cleanup-interval", 30000); + + private static int default_hscan_snapshots_milliseconds_to_live = + Integer.getInteger("redis.hscan-snapshot-expiry", 30000); + + private int HSCAN_SNAPSHOTS_EXPIRE_CHECK_FREQUENCY_MILLISECONDS; + private int MINIMUM_MILLISECONDS_FOR_HSCAN_SNAPSHOTS_TO_LIVE; + + @VisibleForTesting + public RedisHash(List<ByteArrayWrapper> fieldsToSet, int hscanSnapShotExpirationCheckFrequency, + int minimumLifeForHscanSnaphot) { + this(); + + this.HSCAN_SNAPSHOTS_EXPIRE_CHECK_FREQUENCY_MILLISECONDS = + hscanSnapShotExpirationCheckFrequency; + this.MINIMUM_MILLISECONDS_FOR_HSCAN_SNAPSHOTS_TO_LIVE = minimumLifeForHscanSnaphot; - 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, + default_hscan_snapshots_expire_check_frequency, + default_hscan_snapshots_milliseconds_to_live); + } + + // for serialization public RedisHash() { - // for serialization + this.hash = new HashMap<>(); + this.hScanSnapShots = new ConcurrentHashMap<>(); + this.hScanSnapShotCreationTimes = new ConcurrentHashMap<>(); + + this.HSCAN_SNAPSHOTS_EXPIRE_CHECK_FREQUENCY_MILLISECONDS = + this.default_hscan_snapshots_expire_check_frequency; + + this.MINIMUM_MILLISECONDS_FOR_HSCAN_SNAPSHOTS_TO_LIVE = + this.default_hscan_snapshots_milliseconds_to_live; } + + private void expireHScanSnapshots() { + + this.hScanSnapShotCreationTimes.entrySet().forEach(entry -> { Review comment: yeah sorry, posted responses on the wrong comments a couple of times :( ---------------------------------------------------------------- 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: blocks-1.14.0, pull-request-available > -- This message was sent by Atlassian Jira (v8.3.4#803005)