VuFind API Documentation

CachingProxy
in package

Caching Proxy for Cover Images

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$allowedHosts  : array<string|int, mixed>
Array of regular expressions for hosts to cache
$cache  : string
Base directory for cache
$client  : Client
HTTP client
__construct()  : mixed
Constructor
fetch()  : Response
Fetch an image from either a URL or the cache (as appropriate).
fetchCache()  : bool|Response
Load a response from cache (or return false if cache is missing).
getCacheFile()  : string
Get the cache filename corresponding with the provided URL.
hasLegalHost()  : bool
Check if the URL is on the configured list for caching.
setCache()  : void
Save a response to the cache.

Properties

$allowedHosts

Array of regular expressions for hosts to cache

protected array<string|int, mixed> $allowedHosts

Methods

__construct()

Constructor

public __construct(Client $client, string|null $cache[, array<string|int, mixed> $allowedHosts = [] ]) : mixed
Parameters
$client : Client

HTTP client

$cache : string|null

Base directory for cache (null to disable caching)

$allowedHosts : array<string|int, mixed> = []

Array of regular expressions for hosts to cache

Return values
mixed

fetch()

Fetch an image from either a URL or the cache (as appropriate).

public fetch(string $url) : Response
Parameters
$url : string

URL to fetch

Return values
Response

fetchCache()

Load a response from cache (or return false if cache is missing).

protected fetchCache(string $file) : bool|Response
Parameters
$file : string

Cache file to load

Return values
bool|Response

getCacheFile()

Get the cache filename corresponding with the provided URL.

protected getCacheFile(string $url) : string
Parameters
$url : string

URL

Tags
throws
Exception
Return values
string

hasLegalHost()

Check if the URL is on the configured list for caching.

protected hasLegalHost(string $url) : bool
Parameters
$url : string

URL to check

Return values
bool

setCache()

Save a response to the cache.

protected setCache(string $file, Response $response) : void
Parameters
$file : string

Filename to update

$response : Response

Response to write

Return values
void

Search results