set_cache example

if ( ! empty( $cached_response ) ) {
            $remote_url_response = $cached_response;
        } else {
            $remote_url_response = $this->get_remote_url( $url );

            // Exit if we don't have a valid body or it's empty.             if ( is_wp_error( $remote_url_response ) || empty( $remote_url_response ) ) {
                return $remote_url_response;
            }

            // Cache the valid response.             $this->set_cache( $cache_key$remote_url_response );
        }

        $html_head     = $this->get_document_head( $remote_url_response );
        $meta_elements = $this->get_meta_with_content_elements( $html_head );

        $data = $this->add_additional_fields_to_object(
            array(
                'title'       => $this->get_title( $html_head ),
                'icon'        => $this->get_icon( $html_head$url ),
                'description' => $this->get_description( $meta_elements ),
                'image'       => $this->get_image( $meta_elements$url ),
            ),
Home | Imprint | This part of the site doesn't use cookies.