Quantcast
Channel: Geo program design suggestions using Redis - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Karthikeyan Gopall for Geo program design suggestions using Redis

$
0
0

Let me give you an idea base on how i understood your problem:

Instead of storing values in hash, simply store everything in redis. Construct the key as GeoLocation:[Geohash location of robot]:1[indicating the number of post, this will keep on incrementing whenever a new request comes]:timestamp and value will be the timestamp. Similarly for small text GeoLocation:[Geohash location of robot]:1[indicating the number of post]:smallText. Use set expire to set the values and set the expire time as your wish.

Ex: setex GeoLocation:12.31939:1:timestamp 1432423232 (timestamp) 14400 (4 hrs) setex GeoLocation:12.31939:1:smalltext ronaldo 14400

Thus you will get any number of posts from all robots with a distinct key to access and setting expire has also become easy.

Now to get all the info posted by a particular robot, use keys GeoLocation:(location of particular robot):* and get values of each.

In this way you don't need to scan through all the keys in redis. You will get the info relatively quicker and keys are expired by it's own.


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>