MemoryRepository
Provides a simple request-level cache.
class Winter\Storm\Halcyon\MemoryRepository
extends Illuminate\Cache\Repository
Extends
Class | Description |
---|---|
Illuminate\Cache\Repository
|
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 | Type | Description |
---|---|---|
$key | string |
string
|
$value | integer |
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 | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
Returns
bool
public forget (string $key) : bool
Remove an item from the cache.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
Returns
bool
public
get (string | array $key, mixed $default = null
)
Retrieve an item from the cache by key.
Parameters
Property | Type | Description |
---|---|---|
$key | string | array |
string | array
|
$default | mixed |
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 | Type | Description |
---|---|---|
$key | string |
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 | Type | Description |
---|---|---|
$key | string |
string
|
$value | integer |
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 | Type | Description |
---|---|---|
$key | string | array |
string | array
|
$value | mixed |
mixed
|
$seconds | DateTimeInterface | DateInterval | int |
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 | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
Returns
mixed
Copyright © 2024 Winter CMS