Can we use the direct Redis get, set, del commands instead of hget, hset, hdel?
The reason
On using the hash command the expiration of the particular hash list is set to infinity.
And on accessing the Request Cache it iterates all the keys and deletes only one key if the length exceeds the provided max length
It uses hgetAll to iterate all the keys which are of O(N) time.
Proposed Solution
To avoid iterating all the keys, the max length should not be specified.
Because of the absence of max length, the size of the Redis hash list increases and instill the memory load in the Redis server.
Even if the max length is specified, we can use the scan command to iterate through keys 1000 at a time. It optimizes the flow.
For the namespace, we can prefix the key.
To overcome this, we can use the direct Redis commands with separate TTL for every key. On the expiration of the TTL, the Redis itself deletes the key.
We can provide the developers with two different options to use the RedisStore either by hash commands or by direct commands.
Can we use the direct Redis
get
,set
,del
commands instead ofhget
,hset
,hdel
?The reason
hgetAll
to iterate all the keys which are of O(N) time.Proposed Solution
scan
command to iterate through keys 1000 at a time. It optimizes the flow.