CachingDownloader
in package
implements
HttpServiceAwareInterface
Uses
HttpServiceAwareTrait
Caching downloader.
Tags
Interfaces, Classes, Traits and Enums
- HttpServiceAwareInterface
Table of Contents
- $cache : StorageInterface
- Cache to use for downloads
- $cacheId : string
- Cache ID to use for downloads
- $cacheManager : Manager
- CacheManager to update caches if necessary.
- $cacheOptions : array<string|int, mixed>
- Stored client options for cache key generation.
- $configManager : PluginManager
- ConfigManager to get additional settings if necessary.
- __construct() : mixed
- Constructor
- download() : mixed
- Download a resource using the cache in the background.
- downloadJson() : stdClass|array<string|int, mixed>
- Download a resource using the cache in the background, including decoding for JSON.
- setUpCache() : void
- Set up a different cache.
- getDownloaderCache() : StorageInterface
- Get cache and initialize it, if necessary.
Properties
$cache
Cache to use for downloads
protected
StorageInterface
$cache
$cacheId
Cache ID to use for downloads
protected
string
$cacheId
$cacheManager
CacheManager to update caches if necessary.
protected
Manager
$cacheManager
$cacheOptions
Stored client options for cache key generation.
protected
array<string|int, mixed>
$cacheOptions
= []
$configManager
ConfigManager to get additional settings if necessary.
protected
PluginManager
$configManager
Methods
__construct()
Constructor
public
__construct(Manager $cacheManager, PluginManager $configManager) : mixed
Parameters
- $cacheManager : Manager
-
VuFind Cache Manager
- $configManager : PluginManager
-
VuFind Config Manager
Return values
mixed —download()
Download a resource using the cache in the background.
public
download(string $url[, array<string|int, mixed> $params = [] ][, callable|null $decodeCallback = null ]) : mixed
Parameters
- $url : string
-
URL
- $params : array<string|int, mixed> = []
-
Request parameters (e.g. additional headers)
- $decodeCallback : callable|null = null
-
Callback for decoding
Return values
mixed —downloadJson()
Download a resource using the cache in the background, including decoding for JSON.
public
downloadJson(string $url[, array<string|int, mixed> $params = [] ][, bool|null $associative = null ]) : stdClass|array<string|int, mixed>
Parameters
- $url : string
-
URL
- $params : array<string|int, mixed> = []
-
Request parameters (e.g. additional headers)
- $associative : bool|null = null
-
Sent to json_decode
Return values
stdClass|array<string|int, mixed> —setUpCache()
Set up a different cache.
public
setUpCache(string $cacheId[, string $cacheOptionsSection = null ][, string $cacheOptionsFile = null ]) : void
Parameters
- $cacheId : string
-
Cache ID
- $cacheOptionsSection : string = null
-
Cache Options Section
- $cacheOptionsFile : string = null
-
Config file defining the cache options
Return values
void —getDownloaderCache()
Get cache and initialize it, if necessary.
protected
getDownloaderCache() : StorageInterface