I have a requirement to check if the input
number is between 2 ranges lowrange
and highrange
. These range values can be defined as 2 separate columns like below(similar to RDBMS) or maybe any other datastructure
that redis or any in memory cache supports. I know redis
or any other cache for that matter stores key value pair but is there any datastructure that redis has, that can support below use case? I thought of having a string key that can store "lowrange-highrange", but that means I have to iteratively read all the keys of cache, store them locally and then check if my int input is between them.
Input = 12345
Entry in redis
lowrange highrange value
12340 12349 "I am inside this range"