Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 256 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PrivateCacheStrategy:: (7 methods):
  __construct()
  getCacheObject()
  getCacheKey()
  fetch()
  cache()
  update()
  delete()


Class: PrivateCacheStrategy  - X-Ref

This strategy represents a "private" HTTP client.
Pay attention to share storage between application with caution!

For example, a response with cache-control header "private, max-age=60"
will be cached by this strategy.

The rules applied are from RFC 7234.

__construct(CacheStorageInterface $cache = null)   X-Ref


getCacheObject(RequestInterface $request, ResponseInterface $response)   X-Ref

param: RequestInterface $request
param: ResponseInterface $response
return: CacheEntry|null entry to save, null if can't cache it

getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null)   X-Ref
Generate a key for the response cache.

param: RequestInterface   $request
param: null|KeyValueHttpHeader $varyHeaders The vary headers which should be honoured by the cache (optional)
return: string

fetch(RequestInterface $request)   X-Ref
Return a CacheEntry or null if no cache.

param: RequestInterface $request
return: CacheEntry|null

cache(RequestInterface $request, ResponseInterface $response)   X-Ref

param: RequestInterface  $request
param: ResponseInterface $response
return: bool true if success

update(RequestInterface $request, ResponseInterface $response)   X-Ref

param: RequestInterface $request
param: ResponseInterface $response
return: bool true if success

delete(RequestInterface $request)   X-Ref
{@inheritdoc}