cache icon indicating copy to clipboard operation
cache copied to clipboard

Remove get and set from AtomicCache

Open trowski opened this issue 3 years ago • 2 comments

I believe these methods were originally added with the thought this class should also implement Cache, but it doesn't, and as an atomic cache, it likely shouldn't provide methods that could be a footgun.

trowski avatar Jan 02 '22 19:01 trowski

Where do you see footgun potential?

kelunik avatar Jan 02 '22 23:01 kelunik

get and set increase the potential for inadvertently breaking atomicity of the cache by setting a value based on a prior get. get by itself may be acceptable and can perhaps remain, but providing set makes it too easy to break the contract and overwrite a cache value based on a stale value.

trowski avatar Jan 03 '22 15:01 trowski