MatthiasMullie\Scrapbook\Buffered\Utils\Defer::rollback PHP Метод

rollback() защищенный Метод

Roll the cache back to pre-transaction state by comparing the current cache values with what we planned to set them to.
protected rollback ( array $old, array $new )
$old array
$new array
    protected function rollback(array $old, array $new)
    {
        foreach ($old as $key => $value) {
            $current = $this->cache->get($key, $token);
            /*
             * If the value right now equals the one we planned to write, it
             * should be restored to what it was before. If it's yet something
             * else, another process must've stored it and we should leave it
             * alone.
             */
            if ($current === $new) {
                /*
                 * CAS the rollback. If it fails, that means another process
                 * has stored in the meantime and we can just leave it alone.
                 * Note that we can't know the original expiration time!
                 */
                $this->cas($token, $key, $value, 0);
            }
        }
        $this->clear();
    }