protected function getContentFromCache()
    {
        $cache_key = $this->widget->cacheKey();
        $cache_time = $this->widget->cacheTime();

        // Check the existence of the cache.
        if (! cache()->has($cache_key)) {
            // If cache is empty and validation is fails.
            $this->checkWidgetParams();
            // If cache is empty and template file does not exists.
            $this->checkWidgetTemplate();
        }

        return cache()->remember($cache_key, $cache_time, function () {
            return $this->getContent();
        });
    }