ICanBoogie
  • Documentation
  • API Reference
  • HTTP v2.5.0
Namespaces
  • ICanBoogie
    • Exception
    • HTTP
      • Headers
      • Request
      • RequestDispatcher
Classes
  • CacheControl
  • ContentDisposition
  • ContentType
  • Date
  • Header
  • HeaderParameter

Class CacheControl

Representation of the Cache-Control header field.

<?php

use ICanBoogie\HTTP\Headers\CacheControl;

$cc = CacheControl::from('public, max-age=3600');
echo $cc->cacheable;           // true
echo $cc->max_age;             // 3600

$cc->cacheable = 'no-cache';
$cc->max_age = null;
$cc->no_store = true;
$cc->must_revalidate = true;
echo $cc;                      // no-cache, no-store, must-revalidate
ICanBoogie\HTTP\Headers\CacheControl uses ICanBoogie\Accessor\AccessorTrait (not available)
Namespace: ICanBoogie\HTTP\Headers
See: http://tools.ietf.org/html/rfc2616#section-14.9
Located at Headers/CacheControl.php

Methods summary

protected static get_default_values( void ) : array

Returns the default values of the instance.

Returns the default values of the instance.

Returns

array
protected static parse( string $cache_directive ) : array

Parses the provided cache directive.

Parses the provided cache directive.

Parameters

$cache_directive

Returns

array
Returns an array made of the properties and extensions.
public static from( string $source ) : ICanBoogie\HTTP\Headers\CacheControl

Create an instance from the provided source.

Create an instance from the provided source.

Parameters

$source

Returns

ICanBoogie\HTTP\Headers\CacheControl
protected get_cacheable( void ) : string

Returns

string
protected set_cacheable( $value )

Parameters

$value
public __construct( string $cache_directives = null )

If they are defined, the object is initialized with the cache directives.

If they are defined, the object is initialized with the cache directives.

Parameters

$cache_directives
Cache directives.
public __toString( void ) : string

Returns cache directives.

Returns cache directives.

Returns

string
public modify( string $cache_directive )

Sets the cache directives, updating the properties of the object.

Sets the cache directives, updating the properties of the object.

Unknown directives are stashed in the ICanBoogie\HTTP\Headers\CacheControl::$extensions property.

Parameters

$cache_directive

Properties summary

protected static $cacheable_values : array
[

    'private',
    'public',
    'no-cache'

]
protected static $booleans : array
[

    'no-store',
    'no-transform',
    'only-if-cached',
    'must-revalidate',
    'proxy-revalidate'

]
protected static $placeholder : array
[

    'cacheable'

]
public $no_store : boolean

Whether the request/response is can be stored.

Whether the request/response is can be stored.

Scope: request, response.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.2
false
public $max_age : integer

Indicates that the client is willing to accept a response whose age is no greater than the specified time in seconds. Unless max-stale directive is also included, the client is not willing to accept a stale response.

Indicates that the client is willing to accept a response whose age is no greater than the specified time in seconds. Unless max-stale directive is also included, the client is not willing to accept a stale response.

Scope: request.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

		
public $s_maxage : integer

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3

		
public $max_stale : string

Indicates that the client is willing to accept a response that has exceeded its expiration time. If max-stale is assigned a value, then the client is willing to accept a response that has exceeded its expiration time by no more than the specified number of seconds. If no value is assigned to max-stale, then the client is willing to accept a stale response of any age.

Indicates that the client is willing to accept a response that has exceeded its expiration time. If max-stale is assigned a value, then the client is willing to accept a response that has exceeded its expiration time by no more than the specified number of seconds. If no value is assigned to max-stale, then the client is willing to accept a stale response of any age.

Scope: request.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3

		
public $min_fresh : integer

Indicates that the client is willing to accept a response whose freshness lifetime is no less than its current age plus the specified time in seconds. That is, the client wants a response that will still be fresh for at least the specified number of seconds.

Indicates that the client is willing to accept a response whose freshness lifetime is no less than its current age plus the specified time in seconds. That is, the client wants a response that will still be fresh for at least the specified number of seconds.

Scope: request.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3

		
public $no_transform : boolean

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5

Scope: request

, response.
false
public $only_if_cached : boolean

Scope: request.

Scope: request.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4
false
public $must_revalidate : boolean

Scope: response.

Scope: response.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4
false
public $proxy_revalidate : boolean

Scope: response.

Scope: response.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4
false
public $extensions : array

Scope: request, response.

Scope: request, response.

See

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.6
[]

Magic properties

public $cacheable : boolean
HTTP v2.5.0 – Check on GitHub – API documentation generated by ApiGen