\App\Api\ResponseCachedResponse

Response that is saved to cache.

Summary

Methods
Properties
Constants
setName()
getName()
toArray()
toJson()
__construct()
No public properties found
No constants found
getContent()
remember()
$success
$content
$cacheRepository
$cacheKey
$buildCallback
$rememberMinutes
N/A
assertHasName()
$name
N/A

Properties

$success

$success : boolean

Type

boolean

$content

$content : mixed

Type

mixed

$cacheRepository

$cacheRepository : \Illuminate\Cache\Repository

Type

\Illuminate\Cache\Repository

$cacheKey

$cacheKey : string

Type

string

$buildCallback

$buildCallback : \Closure

Type

\Closure

$rememberMinutes

$rememberMinutes : \DateTimeInterface|\DateInterval|float|integer

Type

\DateTimeInterface|\DateInterval|float|integer

$name

$name : string

Type

string

Methods

setName()

setName(string  $name) 

Parameters

string $name

getName()

getName() : string

Name of this response

Returns

string

toArray()

toArray() : array

Return the data as an array

Returns

array

toJson()

toJson(integer  $options) : string

Return the data as a JSON string

Parameters

integer $options

json_encode options

Returns

string

__construct()

__construct(string  $success, string  $cacheKey, \Closure  $buildCallback, \Illuminate\Cache\Repository  $cache, \DateTimeInterface|\DateInterval|float|integer  $rememberMinutes = null) 

Parameters

string $success
string $cacheKey
\Closure $buildCallback
\Illuminate\Cache\Repository $cache
\DateTimeInterface|\DateInterval|float|integer $rememberMinutes

getContent()

getContent() : mixed

Get response content

Returns

mixed

remember()

remember(\Closure|null  $callback = null, string|null  $as = null) : mixed

See Repository::remember.

If $callback and $as are null, uses the CachedResponse::$buildCallback and saves/retrieves as the main response content. Otherwise, saves as an entry that is derived from the main response content.

Parameters

\Closure|null $callback
string|null $as

Throws

\Psr\SimpleCache\InvalidArgumentException

Returns

mixed

assertHasName()

assertHasName() 

Ensure that a response name has been set