nikita-volkov/stm-containers

Add function to delete all elements

Closed this issue · 4 comments

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?

Why not just create a new empty map?

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.

Okay. For such an edge case it makes sense. It's released now.

Whoa, that was fast. Thanks!