Update creates a badger transaction, passing it to a chain of functions,
if all succeed. Useful to use callback to update cache in order to ensure data
in badgerDB and cache are consistent.
OnSucceed adds a callback to execute after the batch has
been successfully flushed.
useful for implementing the cache where we will only cache
after the batch has been successfully flushed