Elgg  Version 5.1
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg\Application\CacheHandler Class Reference

Simplecache handler. More...

Public Member Functions

 __construct (Config $config, Request $request, SimpleCache $simplecache, ConfigTable $config_table)
 Constructor. More...
 
 handleRequest (Request $request, Application $app)
 Handle a request for a cached view. More...
 
 parsePath ($path)
 Parse a request. More...
 
 getContentType ($view)
 Get the content type. More...
 
 getViewFileType ($view)
 Returns the type of output expected from the view. More...
 

Static Public Attributes

static $extensions
 
static static $utf8_content_types
 

Protected Member Functions

 isCacheableView ($view)
 Is the view cacheable. More...
 
 sendCacheHeaders ($etag, Response $response)
 Sets cache headers. More...
 
 setRevalidateHeaders ($etag, Response $response)
 Set revalidate cache headers. More...
 
 is304 ($etag)
 Send a 304 and exit() if the ETag matches the request. More...
 
 getProcessedView ($view, $viewtype)
 Get the contents of a view for caching. More...
 
 renderView ($view, $viewtype)
 Render a view for caching. More...
 
 send403 ($msg= 'Cache error:bad request')
 Send an error message to requestor. More...
 

Protected Attributes

 $config
 
 $request
 
 $simplecache
 
 $simplecache_enabled
 

Detailed Description

Simplecache handler.

Definition at line 18 of file CacheHandler.php.

Constructor & Destructor Documentation

Elgg\Application\CacheHandler::__construct ( Config  $config,
Request  $request,
SimpleCache  $simplecache,
ConfigTable  $config_table 
)

Constructor.

Parameters
Config$configElgg configuration
Request$requestHTTP request
SimpleCache$simplecacheSimplecache
ConfigTable$config_tableConfig table

Definition at line 81 of file CacheHandler.php.

Member Function Documentation

Elgg\Application\CacheHandler::getContentType (   $view)

Get the content type.

Parameters
string$viewThe view name
Returns
string|null

Definition at line 309 of file CacheHandler.php.

Elgg\Application\CacheHandler::getProcessedView (   $view,
  $viewtype 
)
protected

Get the contents of a view for caching.

Parameters
string$viewThe view name
string$viewtypeThe viewtype
Returns
string|false
See also
CacheHandler::renderView()

Definition at line 350 of file CacheHandler.php.

Elgg\Application\CacheHandler::getViewFileType (   $view)

Returns the type of output expected from the view.

  • view/name.extension returns "extension" if "extension" is valid
  • css/view return "css"
  • js/view return "js"
  • Otherwise, returns "unknown"
Parameters
string$viewThe view name
Returns
string

Definition at line 327 of file CacheHandler.php.

Elgg\Application\CacheHandler::handleRequest ( Request  $request,
Application  $app 
)

Handle a request for a cached view.

Parameters
Request$requestElgg request
Application$appElgg application
Returns
Response (unprepared)

Definition at line 103 of file CacheHandler.php.

Elgg\Application\CacheHandler::is304 (   $etag)
protected

Send a 304 and exit() if the ETag matches the request.

Parameters
string$etagETag value
Returns
bool

Definition at line 284 of file CacheHandler.php.

Elgg\Application\CacheHandler::isCacheableView (   $view)
protected

Is the view cacheable.

Language views are handled specially.

Parameters
string$viewView name
Returns
bool

Definition at line 241 of file CacheHandler.php.

Elgg\Application\CacheHandler::parsePath (   $path)

Parse a request.

Parameters
string$pathRequest URL path
Returns
array Cache parameters (empty array if failure)

Definition at line 208 of file CacheHandler.php.

Elgg\Application\CacheHandler::renderView (   $view,
  $viewtype 
)
protected

Render a view for caching.

Language views are handled specially.

Parameters
string$viewThe view name
string$viewtypeThe viewtype
Returns
string|false

Definition at line 374 of file CacheHandler.php.

Elgg\Application\CacheHandler::send403 (   $msg = 'Cache error: bad request')
protected

Send an error message to requestor.

Parameters
string$msgOptional message text
Returns
Response

Definition at line 402 of file CacheHandler.php.

Elgg\Application\CacheHandler::sendCacheHeaders (   $etag,
Response  $response 
)
protected

Sets cache headers.

Parameters
string$etagETag value
Response$responsethe response to set the headers on
Returns
void

Definition at line 258 of file CacheHandler.php.

Elgg\Application\CacheHandler::setRevalidateHeaders (   $etag,
Response  $response 
)
protected

Set revalidate cache headers.

Parameters
string$etagETag value
Response$responsethe response to set the headers on
Returns
void

Definition at line 272 of file CacheHandler.php.

Member Data Documentation

Elgg\Application\CacheHandler::$config
protected

Definition at line 56 of file CacheHandler.php.

Elgg\Application\CacheHandler::$extensions
static
Initial value:
= [
'bmp' => 'image/bmp'

Definition at line 20 of file CacheHandler.php.

Elgg\Application\CacheHandler::$request
protected

Definition at line 61 of file CacheHandler.php.

Elgg\Application\CacheHandler::$simplecache
protected

Definition at line 66 of file CacheHandler.php.

Elgg\Application\CacheHandler::$simplecache_enabled
protected

Definition at line 71 of file CacheHandler.php.

static Elgg\Application\CacheHandler::$utf8_content_types
static
Initial value:
= [
'text/css',
'text/html',
'application/javascript',
'application/json',
'image/svg+xml',
'text/xml',
]

Definition at line 44 of file CacheHandler.php.


The documentation for this class was generated from the following file: