daspecster / ziptastic

This is a Python API for getting zipcodes
http://daspecster.github.com/ziptastic/
127 stars 17 forks source link

Redis #16

Closed tmilewski closed 10 years ago

tmilewski commented 12 years ago

Wouldn't this be the perfect candidate for using Redis as the datastore?

(Note: My opinion. Certainly open to debate.)

ezkl commented 12 years ago

@tmilewski See my fork at https://github.com/ezkl/ziptastic-python/tree/add-redis-backend for a really rough Redis implementation.

I haven't programmed in Python in ages and put this together in a few minutes, so excuse the sloppy code.

daspecster commented 12 years ago

Ah yes, Redis would be amazing...actually TBH it's out backup plan if our api server gets too overloaded haha.

ezkl commented 12 years ago

@daspecster Using Hashes w/ namespace'd keys (i.e. zip:12345) is a really easy way to store the data. Lookup time is negligible due to the unique keys.

If you ever decide to add data from other countries, the hashes could be transitioned to sets (key='zip:12345', val=some_reference_id) that use lists (key=some_reference_id, vals=hash_id#n) of hashes (key=hash_id#n, vals=city,country,state) as a kind of lookup table.