PHP 클래스 Symfony\Component\HttpKernel\HttpCache\HttpCache

저자: Fabien Potencier ([email protected])
상속: implements Symfony\Component\HttpKernel\HttpKernelInterface
파일 보기 프로젝트 열기: symfony/http-kernel 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Symfony\Component\HttpKernel\HttpKernelInterface $kernel, Symfony\Component\HttpKernel\HttpCache\StoreInterface $store, Symfony\Component\HttpKernel\HttpCache\SurrogateInterface $surrogate = null, array $options = [] ) Constructor.
getKernel ( ) : Symfony\Component\HttpKernel\HttpKernelInterface Gets the Kernel instance.
getLog ( ) : string Returns a log message for the events of the last request processing.
getRequest ( ) : Request Gets the Request instance associated with the master request.
getStore ( ) : Symfony\Component\HttpKernel\HttpCache\StoreInterface Gets the current store.
getSurrogate ( ) : Symfony\Component\HttpKernel\HttpCache\SurrogateInterface Gets the Surrogate instance.
getTraces ( ) : array Returns an array of events that took place during processing of the last request.
handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
terminate ( Request $request, Response $response )

보호된 메소드들

메소드 설명
fetch ( Request $request, boolean $catch = false ) : Response Forwards the Request to the backend and determines whether the response should be stored.
forward ( Request $request, boolean $catch = false, Response $entry = null ) : Response Forwards the Request to the backend and returns the Response.
invalidate ( Request $request, boolean $catch = false ) : Response Invalidates non-safe methods (like POST, PUT, and DELETE).
isFreshEnough ( Request $request, Response $entry ) : boolean Checks whether the cache entry is "fresh enough" to satisfy the Request.
lock ( Request $request, Response $entry ) : boolean Locks a Request during the call to the backend.
lookup ( Request $request, boolean $catch = false ) : Response Lookups a Response from the cache for the given Request.
pass ( Request $request, boolean $catch = false ) : Response Forwards the Request to the backend without storing the Response in the cache.
processResponseBody ( Request $request, Response $response )
store ( Request $request, Response $response ) Writes the Response to the cache.
validate ( Request $request, Response $entry, boolean $catch = false ) : Response Validates that a cache entry is fresh.

비공개 메소드들

메소드 설명
isPrivateRequest ( Request $request ) : boolean Checks if the Request includes authorization or other sensitive information that should cause the Response to be considered private by default.
record ( Request $request, string $event ) Records that an event took place.
restoreResponseBody ( Request $request, Response $response ) Restores the Response body.

메소드 상세

__construct() 공개 메소드

The available options are: * debug: If true, the traces are added as a HTTP header to ease debugging * default_ttl The number of seconds that a cache entry should be considered fresh when no explicit freshness information is provided in a response. Explicit Cache-Control or Expires headers override this value. (default: 0) * private_headers Set of request headers that trigger "private" cache-control behavior on responses that don't explicitly state whether the response is public or private via a Cache-Control directive. (default: Authorization and Cookie) * allow_reload Specifies whether the client can force a cache reload by including a Cache-Control "no-cache" directive in the request. Set it to true for compliance with RFC 2616. (default: false) * allow_revalidate Specifies whether the client can force a cache revalidate by including a Cache-Control "max-age=0" directive in the request. Set it to true for compliance with RFC 2616. (default: false) * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the Response TTL precision is a second) during which the cache can immediately return a stale response while it revalidates it in the background (default: 2). This setting is overridden by the stale-while-revalidate HTTP Cache-Control extension (see RFC 5861). * stale_if_error Specifies the default number of seconds (the granularity is the second) during which the cache can serve a stale response when an error is encountered (default: 60). This setting is overridden by the stale-if-error HTTP Cache-Control extension (see RFC 5861).
public __construct ( Symfony\Component\HttpKernel\HttpKernelInterface $kernel, Symfony\Component\HttpKernel\HttpCache\StoreInterface $store, Symfony\Component\HttpKernel\HttpCache\SurrogateInterface $surrogate = null, array $options = [] )
$kernel Symfony\Component\HttpKernel\HttpKernelInterface An HttpKernelInterface instance
$store Symfony\Component\HttpKernel\HttpCache\StoreInterface A Store instance
$surrogate Symfony\Component\HttpKernel\HttpCache\SurrogateInterface A SurrogateInterface instance
$options array An array of options

fetch() 보호된 메소드

This methods is triggered when the cache missed or a reload is required.
protected fetch ( Request $request, boolean $catch = false ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$catch boolean whether to process exceptions
리턴 Symfony\Component\HttpFoundation\Response A Response instance

forward() 보호된 메소드

Forwards the Request to the backend and returns the Response.
protected forward ( Request $request, boolean $catch = false, Response $entry = null ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$catch boolean Whether to catch exceptions or not
$entry Symfony\Component\HttpFoundation\Response A Response instance (the stale entry if present, null otherwise)
리턴 Symfony\Component\HttpFoundation\Response A Response instance

getKernel() 공개 메소드

Gets the Kernel instance.
public getKernel ( ) : Symfony\Component\HttpKernel\HttpKernelInterface
리턴 Symfony\Component\HttpKernel\HttpKernelInterface An HttpKernelInterface instance

getLog() 공개 메소드

Returns a log message for the events of the last request processing.
public getLog ( ) : string
리턴 string A log message

getRequest() 공개 메소드

Gets the Request instance associated with the master request.
public getRequest ( ) : Request
리턴 Symfony\Component\HttpFoundation\Request A Request instance

getStore() 공개 메소드

Gets the current store.
public getStore ( ) : Symfony\Component\HttpKernel\HttpCache\StoreInterface
리턴 Symfony\Component\HttpKernel\HttpCache\StoreInterface $store A StoreInterface instance

getSurrogate() 공개 메소드

Gets the Surrogate instance.
public getSurrogate ( ) : Symfony\Component\HttpKernel\HttpCache\SurrogateInterface
리턴 Symfony\Component\HttpKernel\HttpCache\SurrogateInterface A Surrogate instance

getTraces() 공개 메소드

Returns an array of events that took place during processing of the last request.
public getTraces ( ) : array
리턴 array An array of events

handle() 공개 메소드

public handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
$request Symfony\Component\HttpFoundation\Request

invalidate() 보호된 메소드

Invalidates non-safe methods (like POST, PUT, and DELETE).
또한 보기: RFC2616 13.10
protected invalidate ( Request $request, boolean $catch = false ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$catch boolean Whether to process exceptions
리턴 Symfony\Component\HttpFoundation\Response A Response instance

isFreshEnough() 보호된 메소드

Checks whether the cache entry is "fresh enough" to satisfy the Request.
protected isFreshEnough ( Request $request, Response $entry ) : boolean
$request Symfony\Component\HttpFoundation\Request A Request instance
$entry Symfony\Component\HttpFoundation\Response A Response instance
리턴 boolean true if the cache entry if fresh enough, false otherwise

lock() 보호된 메소드

Locks a Request during the call to the backend.
protected lock ( Request $request, Response $entry ) : boolean
$request Symfony\Component\HttpFoundation\Request A Request instance
$entry Symfony\Component\HttpFoundation\Response A Response instance
리턴 boolean true if the cache entry can be returned even if it is staled, false otherwise

lookup() 보호된 메소드

When a matching cache entry is found and is fresh, it uses it as the response without forwarding any request to the backend. When a matching cache entry is found but is stale, it attempts to "validate" the entry with the backend using conditional GET. When no matching cache entry is found, it triggers "miss" processing.
protected lookup ( Request $request, boolean $catch = false ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$catch boolean whether to process exceptions
리턴 Symfony\Component\HttpFoundation\Response A Response instance

pass() 보호된 메소드

Forwards the Request to the backend without storing the Response in the cache.
protected pass ( Request $request, boolean $catch = false ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$catch boolean Whether to process exceptions
리턴 Symfony\Component\HttpFoundation\Response A Response instance

processResponseBody() 보호된 메소드

protected processResponseBody ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response

store() 보호된 메소드

Writes the Response to the cache.
protected store ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request A Request instance
$response Symfony\Component\HttpFoundation\Response A Response instance

terminate() 공개 메소드

public terminate ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response

validate() 보호된 메소드

The original request is used as a template for a conditional GET request with the backend.
protected validate ( Request $request, Response $entry, boolean $catch = false ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$entry Symfony\Component\HttpFoundation\Response A Response instance to validate
$catch boolean Whether to process exceptions
리턴 Symfony\Component\HttpFoundation\Response A Response instance