protected function persistCacheEntry($key)
    {
        $success = true;
        if (isset($this->cache[$key])) {
            $cache = $this->cache[$key];

            switch ($cache['state']) {
                case self::STATE_PENDING_WRITE:
                    $success = $this->getStorage()->set($cache['userId'], $cache['callId'], $cache['data']);
                    if (!$success) {
                        throw new \common_exception_Error('Can\'t write into test runner state storage at '.static::class);
                    }
                    $this->cache[$key]['state'] = self::STATE_ALIGNED;
                    break;

                case self::STATE_PENDING_DELETE:
                    $success = $this->getStorage()->del($cache['userId'], $cache['callId']);
                    if ($success) {
                        unset($this->cache[$key]);
                    }
                    break;
            }
        }
        return $success;
    }