VuFind API Documentation

Manager
in package

VuFind Cache Manager

Creates caches based on configuration

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Sebastian Kehr kehr@ub.uni-leipzig.de

author

Ere Maijala ere.maijala@helsinki.fi

license

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

link

Main Page

Table of Contents

$caches  : array<string|int, StorageInterface>
Actual cache objects generated from settings.
$cacheSettings  : array<string|int, mixed>
Settings used to generate cache objects.
$cacheSpecs  : array<string|int, mixed>
Cache configuration.
$defaults  : array<string|int, mixed>
Default configuration settings.
$directoryCreationError  : bool
Was there a problem building cache directories?
$factory  : StorageAdapterFactory
Factory for creating storage adapters.
__construct()  : mixed
Constructor
addDownloaderCache()  : string
Create a downloader-specific file cache.
addLanguageCacheForTheme()  : string
Create a new file cache for the given theme name if necessary. Return the name of the cache.
getCache()  : StorageInterface
Retrieve the specified cache object.
getCacheDir()  : string
Get the path to the directory containing VuFind's cache data.
getCacheList()  : array<string|int, mixed>
Get the names of all available caches.
getNonPersistentCacheList()  : array<string|int, mixed>
Get the names of all non-persistent caches (ones that can be cleared).
hasDirectoryCreationError()  : bool
Check if there have been problems creating directories.
createFileCache()  : void
Add a file cache to the manager and ensure that necessary directory exists.
createNoCache()  : void
Create a "no-cache" setting.
ensureFileCache()  : void
Ensure that a file cache is properly set up

Properties

$caches

Actual cache objects generated from settings.

protected array<string|int, StorageInterface> $caches = []

$cacheSettings

Settings used to generate cache objects.

protected array<string|int, mixed> $cacheSettings = []

$cacheSpecs

Cache configuration.

protected array<string|int, mixed> $cacheSpecs = ['browscap' => ['cliOverride' => false, 'directory' => 'browscap', 'options' => [ 'ttl' => 0, // no expiration - cache is updated with console util/browscap 'keyPattern' => '/^[a-z0-9_\\+\\-\\.]*$/Di', ], 'persistent' => true], 'config' => ['directory' => 'configs'], 'cover' => ['directory' => 'covers', 'persistent' => true], 'language' => ['directory' => 'languages'], 'object' => ['directory' => 'objects'], 'public' => ['directory' => 'public'], 'searchspecs' => ['directory' => 'searchspecs'], 'yaml' => ['directory' => 'yamls']]

Following settings are supported:

cliOverride Set to false to not allow cache directory override in CLI mode (optional, true by default) directory Cache directory (required) options Array of cache options (optional, e.g. disabled, ttl) persistent Set to true to disable clearing of the cache by default with the admin API clearCache command (optional, false by default)

$defaults

Default configuration settings.

protected array<string|int, mixed> $defaults

$directoryCreationError

Was there a problem building cache directories?

protected bool $directoryCreationError = false

$factory

Factory for creating storage adapters.

protected StorageAdapterFactory $factory

Methods

__construct()

Constructor

public __construct(Config $config, Config $searchConfig, StorageAdapterFactory $factory) : mixed
Parameters
$config : Config

Main VuFind configuration

$searchConfig : Config

Search configuration

$factory : StorageAdapterFactory

Cache storage adapter factory

Return values
mixed

addDownloaderCache()

Create a downloader-specific file cache.

public addDownloaderCache(string $downloaderName[, array<string|int, mixed> $opts = [] ]) : string
Parameters
$downloaderName : string

Name of the downloader.

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

Cache options.

Return values
string

addLanguageCacheForTheme()

Create a new file cache for the given theme name if necessary. Return the name of the cache.

public addLanguageCacheForTheme(string $themeName) : string
Parameters
$themeName : string

Name of the theme

Return values
string

getCache()

Retrieve the specified cache object.

public getCache(string $name[, string|null $namespace = null ]) : StorageInterface
Parameters
$name : string

Name of the requested cache.

$namespace : string|null = null

Optional namespace to use. Defaults to the value of $name.

Tags
throws
Exception
Return values
StorageInterface

getCacheDir()

Get the path to the directory containing VuFind's cache data.

public getCacheDir([bool $allowCliOverride = true ]) : string
Parameters
$allowCliOverride : bool = true

If true, use a different cache subdirectory for CLI mode; otherwise, share the web directories.

Return values
string

getCacheList()

Get the names of all available caches.

public getCacheList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getNonPersistentCacheList()

Get the names of all non-persistent caches (ones that can be cleared).

public getNonPersistentCacheList() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasDirectoryCreationError()

Check if there have been problems creating directories.

public hasDirectoryCreationError() : bool
Return values
bool

createFileCache()

Add a file cache to the manager and ensure that necessary directory exists.

protected createFileCache(string $cacheName, string $dirName[, array<string|int, mixed> $overrideOpts = [] ]) : void
Parameters
$cacheName : string

Name of new cache to create

$dirName : string

Directory to use for storage

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

Options to override default values.

Return values
void

createNoCache()

Create a "no-cache" setting.

protected createNoCache(string $cacheName) : void
Parameters
$cacheName : string

Name of "no cache" to create

Return values
void

ensureFileCache()

Ensure that a file cache is properly set up

protected ensureFileCache(string $name) : void
Parameters
$name : string

Cache name

Return values
void

Search results