MemoryRepository

Provides a simple request-level cache.

 class Winter\Storm\Halcyon\MemoryRepository
extends Illuminate\Cache\Repository

Extends

Properties

protected $cache : array

Values stored in memory

Methods

public decrement (string $key, integer $value = 1) : int | bool

Decrement the value of an item in the cache.

Parameters
Property Description
$key
string
$value
integer
Returns
int | bool

public flush () : bool

Remove all items from the cache.

Returns
bool

public flushInternalCache ()

Flushes the memory cache.

Calling this directly is generally only useful in testing. Use flush() otherwise.

Returns
mixed

public forever (string $key, mixed $value) : bool

Store an item in the cache indefinitely.

Parameters
Property Description
$key
string
$value
mixed
Returns
bool

public forget (string $key) : bool

Remove an item from the cache.

Parameters
Property Description
$key
string
Returns
bool

public get (string | array $key, mixed $default = null)

Retrieve an item from the cache by key.

Parameters
Property Description
$key
string | array
$default
mixed
Returns
mixed

public getFromMemoryCache (string $key) : mixed | null

Retrieve an item from the internal memory cache without trying the external driver.

Used in testing

Parameters
Property Description
$key
string
Returns
mixed | null

public getPrefix () : string

Get the cache key prefix.

Returns
string

public increment (string $key, integer $value = 1) : int | bool

Increment the value of an item in the cache.

Parameters
Property Description
$key
string
$value
integer
Returns
int | bool

public put (string | array $key, mixed $value, DateTimeInterface | DateInterval | int $seconds = null) : bool

Store an item in the cache.

Parameters
Property Description
$key
string | array
$value
mixed
$seconds
DateTimeInterface | DateInterval | int
Returns
bool

public putInMemoryCache (string $key, mixed $value)

Puts an item in the memory cache, but not in the external cache.

Used in testing

Parameters
Property Description
$key
string
$value
mixed
Returns
mixed
Copyright © 2024 Winter CMS