lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Cache Robustness

Open turbo opened this issue 5 years ago • 0 comments

How is the caching logic implemented? The docs don't really disclose that. Specifically, is the implementation vulnerable against a cache stampede attack?

Vulnerable:

if (!inCache(key)) 
  expensive_calc()
  setCache(key)

Safe:

if (!inCache(key)) 
  aquire_global_lock(key)
  expensive_calc()
  setCache(key)
  release_global_lock(key)

turbo avatar Jul 17 '18 20:07 turbo