PHP Class Eva\EvaEngine\Interceptor\Dispatch

显示文件 Open project: evaengine/evaengine Class Usage Examples

Protected Properties

Property Type Description
$cachableHeaderKeys array HTTP header keys allow to cache WARNING: DONOT cache Set-Cookies!
$cacheBodyKey string Cache key for http body
$cacheHeadersKey string Cache key for http header
$debugQueryKey string default debug query key, url contains this key will make cache re-genrated
$timestampQueryKey 在 url 中加入时间戳,以阻挡网络传输中可能存在的缓存

Public Methods

Method Description
beforeExecuteRoute ( Phalcon\Events\Event $event, Phalcon\Mvc\DispatcherInterface $dispatcher ) : boolean
changeJsonpToJson ( $body, $callback ) : string Change jsonp string to json
generateCacheKeys ( Phalcon\Http\Request $request, array $ignores = [] ) : array Generate cache key pair (for response header / body) by Host + Uri + Allowed Queries
getCachableHeaderKeys ( ) : array
getCacheBodyKey ( ) : string
getCacheHeadersKey ( ) : string
getDebugQueryKey ( ) : string
getInterceptorParams ( Phalcon\Mvc\DispatcherInterface $dispatcher ) : array Parse Dispatcher params to array
injectInterceptor ( Phalcon\Mvc\DispatcherInterface $dispatcher ) : boolean
setCachableHeaderKeys ( array $cachableHeaderKeys )
setDebugQueryKey ( $debugQueryKey )

Protected Methods

Method Description
intercept ( Phalcon\Http\Request $request, array $params, Phalcon\Cache\BackendInterface $cache ) : boolean Intercept a input http request

Method Details

beforeExecuteRoute() public method

public beforeExecuteRoute ( Phalcon\Events\Event $event, Phalcon\Mvc\DispatcherInterface $dispatcher ) : boolean
$event Phalcon\Events\Event
$dispatcher Phalcon\Mvc\DispatcherInterface
return boolean

changeJsonpToJson() public static method

Change jsonp string to json
public static changeJsonpToJson ( $body, $callback ) : string
$body
$callback
return string

generateCacheKeys() public method

Generate cache key pair (for response header / body) by Host + Uri + Allowed Queries
public generateCacheKeys ( Phalcon\Http\Request $request, array $ignores = [] ) : array
$request Phalcon\Http\Request
$ignores array
return array

getCachableHeaderKeys() public method

public getCachableHeaderKeys ( ) : array
return array

getCacheBodyKey() public method

public getCacheBodyKey ( ) : string
return string

getCacheHeadersKey() public method

public getCacheHeadersKey ( ) : string
return string

getDebugQueryKey() public method

public getDebugQueryKey ( ) : string
return string

getInterceptorParams() public method

Parse Dispatcher params to array
public getInterceptorParams ( Phalcon\Mvc\DispatcherInterface $dispatcher ) : array
$dispatcher Phalcon\Mvc\DispatcherInterface
return array

injectInterceptor() public method

public injectInterceptor ( Phalcon\Mvc\DispatcherInterface $dispatcher ) : boolean
$dispatcher Phalcon\Mvc\DispatcherInterface
return boolean true if cache missed(intercepter injected), false if cache hit(intercepter not injected)

intercept() protected method

Intercept a input http request
protected intercept ( Phalcon\Http\Request $request, array $params, Phalcon\Cache\BackendInterface $cache ) : boolean
$request Phalcon\Http\Request
$params array
$cache Phalcon\Cache\BackendInterface
return boolean Will return true if cache hit.

setCachableHeaderKeys() public method

public setCachableHeaderKeys ( array $cachableHeaderKeys )
$cachableHeaderKeys array

setDebugQueryKey() public method

public setDebugQueryKey ( $debugQueryKey )
$debugQueryKey

Property Details

$cachableHeaderKeys protected_oe property

HTTP header keys allow to cache WARNING: DONOT cache Set-Cookies!
protected array $cachableHeaderKeys
return array

$cacheBodyKey protected_oe property

Cache key for http body
protected string $cacheBodyKey
return string

$cacheHeadersKey protected_oe property

Cache key for http header
protected string $cacheHeadersKey
return string

$debugQueryKey protected_oe property

default debug query key, url contains this key will make cache re-genrated
protected string $debugQueryKey
return string

$timestampQueryKey protected_oe property

在 url 中加入时间戳,以阻挡网络传输中可能存在的缓存
protected $timestampQueryKey