\PhpOffice\PhpSpreadsheet\CollectionMemory

This is the default implementation for in-memory cell collection.

Alternatives implementation should leverage off-memory, non-volatile storage to reduce overall memory usage.

Summary

Methods
Properties
Constants
clear()
delete()
deleteMultiple()
get()
getMultiple()
has()
set()
setMultiple()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$cache
N/A

Properties

$cache

$cache

Methods

clear()

clear() : bool

Wipes clean the entire cache's keys.

Returns

bool —

True on success and false on failure.

delete()

delete(mixed  $key) : bool

Delete an item from the cache by its unique key.

Parameters

mixed $key

The unique cache key of the item to delete.

Returns

bool —

True if the item was successfully removed. False if there was an error.

deleteMultiple()

deleteMultiple(mixed  $keys) : bool

Deletes multiple cache items in a single operation.

Parameters

mixed $keys

A list of string-based keys to be deleted.

Returns

bool —

True if the items were successfully removed. False if there was an error.

get()

get(mixed  $key, mixed  $default = null) : mixed

Fetches a value from the cache.

Parameters

mixed $key

The unique key of this item in the cache.

mixed $default

Default value to return if the key does not exist.

Returns

mixed —

The value of the item from the cache, or $default in case of cache miss.

getMultiple()

getMultiple(mixed  $keys, mixed  $default = null) : iterable

Obtains multiple cache items by their unique keys.

Parameters

mixed $keys

A list of keys that can obtained in a single operation.

mixed $default

Default value to return for keys that do not exist.

Returns

iterable —

A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.

has()

has(mixed  $key) : bool

Determines whether an item is present in the cache.

NOTE: It is recommended that has() is only to be used for cache warming type purposes and not to be used within your live applications operations for get/set, as this method is subject to a race condition where your has() will return true and immediately after, another script can remove it making the state of your app out of date.

Parameters

mixed $key

The cache item key.

Returns

bool —

set()

set(mixed  $key, mixed  $value, mixed  $ttl = null) : bool

Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.

Parameters

mixed $key

The key of the item to store.

mixed $value

The value of the item to store, must be serializable.

mixed $ttl

Optional. The TTL value of this item. If no value is sent and the driver supports TTL then the library may set a default value for it or let the driver take care of that.

Returns

bool —

True on success and false on failure.

setMultiple()

setMultiple(mixed  $values, mixed  $ttl = null) : bool

Persists a set of key => value pairs in the cache, with an optional TTL.

Parameters

mixed $values

A list of key => value pairs for a multiple-set operation.

mixed $ttl

Optional. The TTL value of this item. If no value is sent and the driver supports TTL then the library may set a default value for it or let the driver take care of that.

Returns

bool —

True on success and false on failure.