Documentation

CacheAdapterInterface

Interface for cache adapters.

Cache adapters allow Guzzle to utilize various frameworks for caching HTTP responses.

Tags
link

Inspired by Doctrine 2

Table of Contents

contains()  : bool
Test if an entry exists in the cache.
delete()  : bool
Deletes a cache entry.
fetch()  : string
Fetches an entry from the cache.
save()  : bool
Puts data into the cache.

Methods

contains()

Test if an entry exists in the cache.

public contains(string $id[, array<string|int, mixed> $options = null ]) : bool
Parameters
$id : string

cache id The cache id of the entry to check for.

$options : array<string|int, mixed> = null

Array of cache adapter options

Return values
bool

Returns TRUE if a cache entry exists for the given cache id, FALSE otherwise.

delete()

Deletes a cache entry.

public delete(string $id[, array<string|int, mixed> $options = null ]) : bool
Parameters
$id : string

cache id

$options : array<string|int, mixed> = null

Array of cache adapter options

Return values
bool

TRUE on success, FALSE on failure

fetch()

Fetches an entry from the cache.

public fetch(string $id[, array<string|int, mixed> $options = null ]) : string
Parameters
$id : string

cache id The id of the cache entry to fetch.

$options : array<string|int, mixed> = null

Array of cache adapter options

Return values
string

The cached data or FALSE, if no cache entry exists for the given id.

save()

Puts data into the cache.

public save(string $id, string $data[, int|bool $lifeTime = false ][, array<string|int, mixed> $options = null ]) : bool
Parameters
$id : string

The cache id

$data : string

The cache entry/data

$lifeTime : int|bool = false

The lifetime. If != false, sets a specific lifetime for this cache entry

$options : array<string|int, mixed> = null

Array of cache adapter options

Return values
bool

TRUE if the entry was successfully stored in the cache, FALSE otherwise.

Search results