Add function to delete all elements
Closed this issue · 4 comments
agentm commented
I am using an STMMap to store some session information. Once a session is done, however, it would be handy to be able to delete the elements from the STMMap. Is there a better way to do this than stream + traverse_ + delete?
nikita-volkov commented
Why not just create a new empty map?
neongreen commented
Here's what I have:
type Cache = STMMap.Map CacheKey BSL.ByteString
cache :: Cache
{-# NOINLINE cache #-}
cache = unsafePerformIO STMMap.newIO
How can I use new
or newIO
to replace cache
with an empty map? There might be a way but currently I don't see it.
nikita-volkov commented
Okay. For such an edge case it makes sense. It's released now.
neongreen commented
Whoa, that was fast. Thanks!