`get_or_create` gets twice (docs deficiency?)

Issue #89 new
jvanasco
created an issue

Looking at some performance logs during an audit, it appeared that our dogpile implementation was broken -- there would often be two identical cache misses in a row.

After stacktracing and looking through source, the issue was simple enough and a non-issue -- dogpile.core.dogpile.Lock is implemented in such a way that the logic flows on a get/create like this:

• get • create • get again (protect against race conditions) • set

I think it would be helpful to just add a line to the API docs about this, as I couldn't find anything in dogpile.cache addressing it -- and it sure looks like I broke something, even when everything is working exactly as it should.

Note: `get_or_create` utilizes the `Lock` mechanism from `dogpile.core`. In order to protect against race conditions, a secondary call to 'get' is made before the call to `set`.

Comments (0)

  1. Log in to comment