Transactional cache with configurable persistence