Refactor RedisItemWriter and RedisItemReader logic #4651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I believe there might be a better way to implement the RedisItemReader and RedisItemWriter. Currently, the RedisItemReader stores the Redis data's value in the chunk. The RedisItemWriter then uses an ItemKeyMapper to derive the key from this value and executes the writeKeyValue function with the key and value.
However, I find it quite cumbersome to implement an ItemKeyMapper that derives the key from the value. In a key-value structure, retrieving the key based on the value seems to underutilize the key-value paradigm.
When I was setting up a batch job to delete specific Redis data, I found it inefficient to implement an ItemKeyMapper that derives the key from the value, so I customized the code accordingly. Instead, I implemented the ItemKeyMapper to return the value when given a key.
Therefore, I believe it would be more efficient for the RedisItemReader to store the Redis data's keys in the chunk. If my suggestion is not accepted, I would be very interested in understanding the reasoning behind that decision.
Thank you for considering my suggestion.