ttlcache
ttlcache copied to clipboard
Add a method that activates transaction mode
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.