Elgg  Version 3.0
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_enabled)
 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

 $simplecache_enabled
 

Detailed Description

Simplecache handler.

Definition at line 17 of file CacheHandler.php.

Constructor & Destructor Documentation

Elgg\Application\CacheHandler::__construct ( Config  $config,
Request  $request,
  $simplecache_enabled 
)

Constructor.

Parameters
Config$configElgg configuration
Request$requestHTTP request
bool$simplecache_enabledIs the simplecache enabled?

Definition at line 67 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 279 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 323 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 300 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 80 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 256 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 216 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 185 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 350 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 376 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 231 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 245 of file CacheHandler.php.

Member Data Documentation

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

Definition at line 19 of file CacheHandler.php.

Elgg\Application\CacheHandler::$simplecache_enabled
protected

Definition at line 58 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 42 of file CacheHandler.php.


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