geodis
geodis copied to clipboard
Passing store=False seems to store
Trying to follow the flow here.
https://github.com/EverythingMe/geodis/blob/master/geodis/index.py#L228
if not store:
redisConn.zunionstore(tmpKey, list(closest))
return redisConn.zrevrange(tmpKey, 0, -1, withscores=True)
else:
return list(closest)
It looks like if I don't want to store anything, I should pass store=True
Thanks, I've written this code so long ago, I'll need to do some diving in, but ACK
My issue was 100's of megabytes of stored keys for lat/lon. I ended up with the following, to avoid the storage.
p = redis.pipeline(False)
all_city_ids = set()
union_keys = cls._keys['geoname'].getIds(redis, lat=lat, lon=lon, radius=radius, store=True)
for union_key in union_keys:
p.zrange(union_key, 0, -1)
for city_ids in p.execute():
all_city_ids.update(city_ids)
getIds(store=True)
returns set names that need to be unioned in memory instead of in redis.