Cache
in package
implements
ArrayAccess
Cache class
Tags
Table of Contents
Interfaces
- ArrayAccess
Properties
- $adapter : AdapterInterface|null
- Cache adapter
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- Magic get method to return an item from cache
- __isset() : bool
- Determine if the item is in cache
- __set() : void
- Magic set method to save an item in the cache
- __unset() : void
- Delete value from cache
- adapter() : AdapterInterface|null
- Get the adapter
- clear() : void
- Clear all stored values from cache
- deleteItem() : void
- Delete an item in cache
- deleteItems() : void
- Delete items in cache
- destroy() : void
- Destroy cache resource
- getAvailableAdapters() : array<string|int, mixed>
- Determine available adapters
- getItem() : mixed
- Get an item from cache
- getItemTtl() : int
- Get item cache TTL
- getTtl() : int
- Get global cache TTL
- hasItem() : bool
- Determine if the item is in cache
- isAvailable() : bool
- Determine if an adapter is available
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- saveItem() : void
- Save an item to cache
- saveItems() : void
- Save items to cache
Properties
$adapter
Cache adapter
protected
AdapterInterface|null
$adapter
= null
Methods
__construct()
Constructor
public
__construct(AdapterInterface $adapter) : mixed
Instantiate the cache object
Parameters
- $adapter : AdapterInterface
__get()
Magic get method to return an item from cache
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Determine if the item is in cache
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Magic set method to save an item in the cache
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__unset()
Delete value from cache
public
__unset(string $name) : void
Parameters
- $name : string
adapter()
Get the adapter
public
adapter() : AdapterInterface|null
Return values
AdapterInterface|nullclear()
Clear all stored values from cache
public
clear() : void
deleteItem()
Delete an item in cache
public
deleteItem(string $id) : void
Parameters
- $id : string
deleteItems()
Delete items in cache
public
deleteItems(array<string|int, mixed> $ids) : void
Parameters
- $ids : array<string|int, mixed>
destroy()
Destroy cache resource
public
destroy() : void
getAvailableAdapters()
Determine available adapters
public
static getAvailableAdapters() : array<string|int, mixed>
Return values
array<string|int, mixed>getItem()
Get an item from cache
public
getItem(string $id) : mixed
Parameters
- $id : string
getItemTtl()
Get item cache TTL
public
getItemTtl(string $id) : int
Parameters
- $id : string
Return values
intgetTtl()
Get global cache TTL
public
getTtl() : int
Return values
inthasItem()
Determine if the item is in cache
public
hasItem(string $id) : bool
Parameters
- $id : string
Return values
boolisAvailable()
Determine if an adapter is available
public
static isAvailable(string $adapter) : bool
Parameters
- $adapter : string
Return values
booloffsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
saveItem()
Save an item to cache
public
saveItem(string $id, mixed $value[, int|null $ttl = null ]) : void
Parameters
- $id : string
- $value : mixed
- $ttl : int|null = null
saveItems()
Save items to cache
public
saveItems(array<string|int, mixed> $items) : void
Parameters
- $items : array<string|int, mixed>