I am using Redis as cache only. I am performing IO expensive data and storing in redis. Eg of data:
[{"fname": "temp.txt", "size": 50, "type":"pdf", "mt": "Timestamp"},{..},...]
Now, due to data being an array of object, I have converted the data into an array of strings (Stringified JSON). The only case when the data is not in cache is if it's evicted or there are changes in data in which case I remove the key-value pair.
MY Concern:
In some cases, I have to store an empty array (no data for key) in Redis. How can I achieve this? The issue is I cannot reevaluate if data for the key is indeed empty or does not exist (in which Redis returns an empty array as well) and since it's an IO-intensive work I don't want to waste resource on reevaluation.
What is the best way to resolve this issue? Any help/suggestion on caching, approach or designing is equally appreciated.