So at first, I did:

```
transaction start:
  deletion_queue ||= Set.new

delete while in transaction:
  deletion_queue << item

transaction_end:
  for item in deletion_queue:
    delete item
  deletion_queue.clear
```

This didn't work because of this situation:

```
begin transaction A {
  update R1
  update R1
  begin transaction B {
    update R2
  }
  update R1
}
```

The expected behaviour would be that R1 and R2 are both deleted from memcached exactly once, but with the algorithm described above, R1 is deleted twice, since the queue is flushed at the COMMIT for transaction B but transaction A continues to modify R1 afterward.