MemcachedStore
extends TaggableStore
in package
implements
LockProvider, Store
Uses
InteractsWithTime
Interfaces, Classes and Traits
Table of Contents
- $memcached : Memcached
- The Memcached instance.
- $onVersionThree : bool
- Indicates whether we are using Memcached version >= 3.0.0.
- $prefix : string
- A string that should be prepended to keys.
- __construct() : void
- Create a new Memcached store.
- add() : bool
- Store an item in the cache if the key doesn't exist.
- decrement() : int|bool
- Decrement the value of an item in the cache.
- flush() : bool
- Remove all items from the cache.
- forever() : void
- Store an item in the cache indefinitely.
- forget() : bool
- Remove an item from the cache.
- get() : mixed
- Retrieve an item from the cache by key.
- getMemcached() : Memcached
- Get the underlying Memcached connection.
- getPrefix() : string
- Get the cache key prefix.
- increment() : int|bool
- Increment the value of an item in the cache.
- lock() : Lock
- Get a lock instance.
- many() : array<string|int, mixed>
- Retrieve multiple items from the cache by key.
- put() : void
- Store an item in the cache for a given number of minutes.
- putMany() : void
- Store multiple items in the cache for a given number of minutes.
- setPrefix() : void
- Set the cache key prefix.
- tags() : TaggedCache
- Begin executing a new tags operation.
- availableAt() : int
- Get the "available at" UNIX timestamp.
- currentTime() : int
- Get the current system time as a UNIX timestamp.
- parseDateInterval() : DateTimeInterface|int
- If the given value is an interval, convert it to a DateTime instance.
- secondsUntil() : int
- Get the number of seconds until the given DateTime.
- toTimestamp() : int
- Get the UNIX timestamp for the given number of minutes.
Properties
$memcached
The Memcached instance.
protected
Memcached
$memcached
$onVersionThree
Indicates whether we are using Memcached version >= 3.0.0.
protected
bool
$onVersionThree
$prefix
A string that should be prepended to keys.
protected
string
$prefix
Methods
__construct()
Create a new Memcached store.
public
__construct(Memcached $memcached[, string $prefix = '' ]) : void
Parameters
- $memcached : Memcached
- $prefix : string = ''
Return values
void —add()
Store an item in the cache if the key doesn't exist.
public
add(string $key, mixed $value, float|int $minutes) : bool
Parameters
- $key : string
- $value : mixed
- $minutes : float|int
Return values
bool —decrement()
Decrement the value of an item in the cache.
public
decrement(string $key[, mixed $value = 1 ]) : int|bool
Parameters
- $key : string
- $value : mixed = 1
Return values
int|bool —flush()
Remove all items from the cache.
public
flush() : bool
Return values
bool —forever()
Store an item in the cache indefinitely.
public
forever(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
Return values
void —forget()
Remove an item from the cache.
public
forget(string $key) : bool
Parameters
- $key : string
Return values
bool —get()
Retrieve an item from the cache by key.
public
get(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getMemcached()
Get the underlying Memcached connection.
public
getMemcached() : Memcached
Return values
Memcached —getPrefix()
Get the cache key prefix.
public
getPrefix() : string
Return values
string —increment()
Increment the value of an item in the cache.
public
increment(string $key[, mixed $value = 1 ]) : int|bool
Parameters
- $key : string
- $value : mixed = 1
Return values
int|bool —lock()
Get a lock instance.
public
lock(string $name, int $seconds) : Lock
Parameters
- $name : string
- $seconds : int
Return values
Lock —many()
Retrieve multiple items from the cache by key.
public
many(array<string|int, mixed> $keys) : array<string|int, mixed>
Items not found in the cache will have a null value.
Parameters
- $keys : array<string|int, mixed>
Return values
array<string|int, mixed> —put()
Store an item in the cache for a given number of minutes.
public
put(string $key, mixed $value, float|int $minutes) : void
Parameters
- $key : string
- $value : mixed
- $minutes : float|int
Return values
void —putMany()
Store multiple items in the cache for a given number of minutes.
public
putMany(array<string|int, mixed> $values, float|int $minutes) : void
Parameters
- $values : array<string|int, mixed>
- $minutes : float|int
Return values
void —setPrefix()
Set the cache key prefix.
public
setPrefix(string $prefix) : void
Parameters
- $prefix : string
Return values
void —tags()
Begin executing a new tags operation.
public
tags(array<string|int, mixed>|mixed $names) : TaggedCache
Parameters
- $names : array<string|int, mixed>|mixed
Return values
TaggedCache —availableAt()
Get the "available at" UNIX timestamp.
protected
availableAt(DateTimeInterface|DateInterval|int $delay) : int
Parameters
- $delay : DateTimeInterface|DateInterval|int
Return values
int —currentTime()
Get the current system time as a UNIX timestamp.
protected
currentTime() : int
Return values
int —parseDateInterval()
If the given value is an interval, convert it to a DateTime instance.
protected
parseDateInterval(DateTimeInterface|DateInterval|int $delay) : DateTimeInterface|int
Parameters
- $delay : DateTimeInterface|DateInterval|int
Return values
DateTimeInterface|int —secondsUntil()
Get the number of seconds until the given DateTime.
protected
secondsUntil(DateTimeInterface|DateInterval|int $delay) : int
Parameters
- $delay : DateTimeInterface|DateInterval|int
Return values
int —toTimestamp()
Get the UNIX timestamp for the given number of minutes.
protected
toTimestamp(int $minutes) : int
Parameters
- $minutes : int