PHP Class WP_Spider_Cache_Output

Mostra file Open project: stuttter/wp-spider-cache

Public Properties

Property Type Description
$cache_control boolean Set false to disable Last-Modified and Cache-Control headers
$cache_redirects boolean Set true to enable redirect caching.
$cancel boolean Change this to cancel the output buffer. Use wp_output_cache_cancel();
$debug boolean Set false to hide the spider_cache info
$group string Name of cache group. You can simulate a cache flush by changing this.
$headers array These will be sent with every response from the cache.
$max_age integer Maximum age of a cached page in seconds
$noskip_cookies array Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it.
$redirect_location boolean This is set to the redirect location.
$redirect_status boolean This is set to the response code during a redirect.
$remote boolean False disables sending buffers to remote datacenters
$seconds integer ...in this many seconds (zero to ignore this and use spider_cache immediately)
$skip_cookies array Names of cookies - if they exist bypass caching.
$started integer The timestamp when the object was created
$times integer .. (two or more)
$uncached_headers array These headers will never be cached. Apply strtolower.
$unique array If you conditionally serve different content, put the variable values here.
$vary array Array of functions for create_function. The return value is added to $unique above.

Public Methods

Method Description
__construct ( ) Main spider_cache constructor
redirect_status ( string $status, string $location ) : type Set the redirect status, and whether it should be cached
status_header ( string $status_header, integer $status_code = 200 ) : string Set the status header & code

Protected Methods

Method Description
add_debug_from_cache ( ) Add verbose debug info
add_debug_html_to_output ( string $debug_html = '' ) : void Determine where to put what debug output
add_debug_just_cached ( ) Add some debug info
add_variant ( string $function = '' ) Add a variant to the cache key
configure_groups ( ) Configure the cache client
do_headers ( array $headers1, array $headers2 = [] ) Merge the headers and send them off
do_variants ( type $dimensions = false ) Set the cache with it's variant keys
generate_keys ( ) Generate cache keys for the request
ob ( string $output = '' ) : string Start the output buffer
start ( ) : void Start page caching and hook into requests to complete it later

Private Methods

Method Description
has_cookies ( ) : boolean Return whether or not user related cookies have been detected
is_ssl ( ) : boolean Determine if SSL is used
set_skip_cookies ( ) Look for predefined constants, and add them to the skip_cookies array
timer_stop ( $display = true, $precision = 3 ) Defined here because timer_stop() calls number_format_i18n()

Method Details

__construct() public method

Main spider_cache constructor
Since: 2.0.0
public __construct ( )

add_debug_from_cache() protected method

Add verbose debug info
Since: 2.0.0
protected add_debug_from_cache ( )

add_debug_html_to_output() protected method

Determine where to put what debug output
Since: 2.0.0
protected add_debug_html_to_output ( string $debug_html = '' ) : void
$debug_html string
return void

add_debug_just_cached() protected method

Add some debug info
Since: 2.0.0
protected add_debug_just_cached ( )

add_variant() protected method

Add a variant to the cache key
Since: 2.0.0
protected add_variant ( string $function = '' )
$function string

configure_groups() protected method

Configure the cache client
Since: 2.0.0
protected configure_groups ( )

do_headers() protected method

Merge the headers and send them off
Since: 2.0.0
protected do_headers ( array $headers1, array $headers2 = [] )
$headers1 array
$headers2 array

do_variants() protected method

Set the cache with it's variant keys
Since: 2.0.0
protected do_variants ( type $dimensions = false )
$dimensions type

generate_keys() protected method

Generate cache keys for the request
Since: 2.0.0
protected generate_keys ( )

ob() protected method

Start the output buffer
Since: 2.0.0
protected ob ( string $output = '' ) : string
$output string
return string

redirect_status() public method

Set the redirect status, and whether it should be cached
Since: 2.0.0
public redirect_status ( string $status, string $location ) : type
$status string
$location string
return type

start() protected method

Start page caching and hook into requests to complete it later
Since: 2.1.0
protected start ( ) : void
return void

status_header() public method

Set the status header & code
Since: 2.0.0
public status_header ( string $status_header, integer $status_code = 200 ) : string
$status_header string
$status_code integer
return string

Property Details

$cache_control public_oe property

Set false to disable Last-Modified and Cache-Control headers
public bool $cache_control
return boolean

$cache_redirects public_oe property

Set true to enable redirect caching.
public bool $cache_redirects
return boolean

$cancel public_oe property

Change this to cancel the output buffer. Use wp_output_cache_cancel();
public bool $cancel
return boolean

$debug public_oe property

Set false to hide the spider_cache info
public bool $debug
return boolean

$group public_oe property

Name of cache group. You can simulate a cache flush by changing this.
public string $group
return string

$headers public_oe property

These will be sent with every response from the cache.
public array $headers
return array

$max_age public_oe property

Maximum age of a cached page in seconds
public int $max_age
return integer

$noskip_cookies public_oe property

Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it.
public array $noskip_cookies
return array

$redirect_location public_oe property

This is set to the redirect location.
public bool $redirect_location
return boolean

$redirect_status public_oe property

This is set to the response code during a redirect.
public bool $redirect_status
return boolean

$remote public_oe property

False disables sending buffers to remote datacenters
public bool $remote
return boolean

$seconds public_oe property

...in this many seconds (zero to ignore this and use spider_cache immediately)
public int $seconds
return integer

$skip_cookies public_oe property

Names of cookies - if they exist bypass caching.
public array $skip_cookies
return array

$started public_oe property

The timestamp when the object was created
public int $started
return integer

$times public_oe property

.. (two or more)
public int $times
return integer

$uncached_headers public_oe property

These headers will never be cached. Apply strtolower.
public array $uncached_headers
return array

$unique public_oe property

If you conditionally serve different content, put the variable values here.
public array $unique
return array

$vary public_oe property

Array of functions for create_function. The return value is added to $unique above.
public array $vary
return array