Possible to safely get and del (conditionally remove)?
ylg opened this issue · comments
I believe del
and delMany
suffer from a concurrency issue similar to set
and setMany
, i.e., if you need to check the value before deleting the key, it may well have changed to a value you would not want to delete between the get
and the del
. Is that correct?
Fwiw, it's fine to call del
on things that don't exist - it doesn't throw.
When you really need transactional stuff, https://www.npmjs.com/package/idb is a better choice. There's even an example that's similar to this library https://www.npmjs.com/package/idb#examples
Thanks. Since this lib does have a solution for the get-set issue, i.e., update, I wanted to be sure I wasn't missing anything vis-a-vis get-del. But, I am using the idb lib for this now and it works well.