global

def before_commit

obtain old data before the clear, and then save the old data after it.
the cache. If the writer cleared the cache after commit, the reader could
a reader must wait for a concurrent writer to commit before continuing to
reading/refreshing the cache to obtain a FOR SHARE lock, which means that
on database locking to prevent cache race conditions. We require
It's important that we clear the cache before committing, because we rely
def before_commit
  cache.delete(id)
end