ttlcache icon indicating copy to clipboard operation
ttlcache copied to clipboard

Add a method that activates transaction mode

Open swithek opened this issue 2 years ago • 0 comments

It would be nice to have a method that would accept a function and execute it with a new global transaction mutex locked:

func (c *Cache[K, V]) Tx(fn func(*Tx[K, V])) {
         c.txMu.Lock()
         tx := c.beginTx()
         fn(tx)
         c.txMu.Unlock()
}

This was addressed in this issue, however, due to some limitations of the previous versions it was closed.

swithek avatar Mar 29 '22 11:03 swithek