Closed jesseditson closed 8 years ago
Hey there @jesseditson,
The difference for addLocation
and updateLocation
is purely semantic. They perform the same thing in reality, that is an "upsert" (as you call it).
That is, if the location doesn't exist it will be added, and if it does it will be updated, no matter which method you use. So take your pick :)
You can see more in the source here. You can see they're both actually the same method :)
The reason for this behavior is because Redis automatically does that by default for the commands we're using (ZADD for emulation mode and GEOADD for native mode).
Ah, fantastic! Thanks so much for the clarification, and thanks again for the lib!
Thank you! Let me know if you encounter any strange behaviour. It was a recent rewrite (to 3.0.0) so I'm on edge :)
Absolutely! I'm working it in to a project now, I'll be sure to file anything I run across here!
Hey, thanks for this awesome library.
I was wondering about the difference between
addLocation
andupdateLocation
- in my application, I am looking to do an "upsert" - just to add or update depending on if the location already exists. Does one or both of these methods already expose this functionality? And if not, is there a way to avoid doing aget
and then anupdate
oradd
depending on the existence of the value returned by get?