Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy Class Reference
Inheritance diagram for Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy:
Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

Public Member Functions

 __construct (CacheStorageInterface $cache=null, $defaultTtl, KeyValueHttpHeader $varyHeaders=null)
 
 cache (RequestInterface $request, ResponseInterface $response)
 
 delete (RequestInterface $request)
 {{
Parameters
RequestInterface$request
Return values
bool
}}
 
 fetch (RequestInterface $request)
 Return a CacheEntry or null if no cache.
 
 update (RequestInterface $request, ResponseInterface $response)
 

Public Attributes

const HEADER_TTL = 'X-Kevinrob-GuzzleCache-TTL'
 

Protected Member Functions

 getCacheKey (RequestInterface $request, KeyValueHttpHeader $varyHeaders=null)
 Generate a key for the response cache.
 
 getCacheObject (RequestInterface $request, ResponseInterface $response)
 

Protected Attributes

string[] $ageKey
 
int $defaultTtl
 
int[] $statusAccepted
 
CacheStorageInterface $storage
 

Member Function Documentation

◆ cache()

Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy::cache ( RequestInterface $request,
ResponseInterface $response )
Parameters
RequestInterface$request
ResponseInterface$response
Return values
booltrue if success

Reimplemented from Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy.

◆ delete()

Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy::delete ( RequestInterface $request)

{{

Parameters
RequestInterface$request
Return values
bool
}}

Reimplemented from Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy.

◆ fetch()

Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy::fetch ( RequestInterface $request)

Return a CacheEntry or null if no cache.

Parameters
RequestInterface$request
Return values
CacheEntry|null

Reimplemented from Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy.

◆ getCacheKey()

Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy::getCacheKey ( RequestInterface $request,
KeyValueHttpHeader $varyHeaders = null )
protected

Generate a key for the response cache.

Parameters
RequestInterface$request
null | KeyValueHttpHeader$varyHeadersThe vary headers which should be honoured by the cache (optional)
Return values
string

Reimplemented from Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy.

◆ getCacheObject()

Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy::getCacheObject ( RequestInterface $request,
ResponseInterface $response )
protected
Parameters
RequestInterface$request
ResponseInterface$response
Return values
CacheEntry|nullentry to save, null if can't cache it

Reimplemented from Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy.

◆ update()

Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy::update ( RequestInterface $request,
ResponseInterface $response )
inherited
Parameters
RequestInterface$request
ResponseInterface$response
Return values
booltrue if success

Implements Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface.

Member Data Documentation

◆ $ageKey

string [] Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy::$ageKey
protectedinherited
Initial value:
= [
'max-age',
]

◆ $statusAccepted

int [] Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy::$statusAccepted
protectedinherited
Initial value:
= [
200 => 200,
203 => 203,
204 => 204,
300 => 300,
301 => 301,
404 => 404,
405 => 405,
410 => 410,
414 => 414,
418 => 418,
501 => 501,
]

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