muesli / cache2go

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

new cache double check #21

Closed kimmykuang closed 5 years ago

kimmykuang commented 5 years ago

what are the advantages doing double check table name exists in cache2go.Cache?

muesli commented 5 years ago

See: https://github.com/muesli/cache2go/pull/11

Essentially: between read-locking and locking, the table might have been created in another thread.

kimmykuang commented 5 years ago

thanks.

Deep-Coder-zhui commented 4 years ago

@muesli ,I think the RLock() may be not needed because of the double check