muesli / cache2go

Concurrency-safe Go caching library with expiration capabilities and access counters
Other
2.11k stars 516 forks source link

Double check whether the table exists or not when creating new one #11

Closed emac closed 7 years ago

emac commented 7 years ago

Just like the double-check pattern when implementing Singleton, see https://en.wikipedia.org/wiki/Double-checked_locking

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 0280a239e7cd171f56d81836f95e0fb18269356e on emac:master into 21535fde2439232ab97cbebc6343c68e8672f94b on muesli:master.

muesli commented 7 years ago

Thanks for the fix! Just curious, did you actually run into issues with this in a real situation, or did you discover it by a purely theoretical glance at the code? :)

emac commented 7 years ago

Not yet. I found this issue while we were reading your code in a team technique activity. :)