unserialize
laravel/octane
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Creates a PHP value from a stored representation
unserialize
(
string $data
, array
$options
= []):
mixed
$record
=
$this
->
table
->
get
(
$key
);
if (!
$this
->
recordIsFalseOrExpired
(
$record
)) {
return
unserialize
(
$record
[
'value'
]);
}
if (
in_array
(
$key
,
$this
->
intervals
) &&
src/Cache/OctaneStore.php
{
$interval
=
$this
->
get
(
'interval-'
.
$key
);
return
$interval
?
unserialize
(
$interval
) :
null
;
}
src/Cache/OctaneStore.php
return
tap
(
$value
, fn (
$value
) =>
$this
->
put
(
$key
,
$value
, static::
ONE_YEAR
));
}
return
tap
((int) (
unserialize
(
$record
[
'value'
]) +
$value
), function (
$value
) use (
$key
,
$record
) {
$this
->
put
(
$key
,
$value
,
$record
[
'expiration'
] -
Carbon
::
now
()->
getTimestamp
());
});
}
src/Cache/OctaneStore.php
OctaneFacade
::
route
(
'POST'
,
'/octane/resolve-tasks'
, function (
Request $request
) {
try {
return new
Response
(
serialize
((new
SwooleTaskDispatcher
)->
resolve
(
unserialize
(
Crypt
::
decryptString
(
$request
->
input
(
'tasks'
))),
$request
->
input
(
'wait'
)
)),
200
);
} catch (
DecryptException
) {
src/OctaneServiceProvider.php
OctaneFacade
::
route
(
'POST'
,
'/octane/dispatch-tasks'
, function (
Request $request
) {
try {
(new
SwooleTaskDispatcher
)->
dispatch
(
unserialize
(
Crypt
::
decryptString
(
$request
->
input
(
'tasks'
))),
);
} catch (
DecryptException
) {
return new
Response
(
''
,
403
);
src/OctaneServiceProvider.php
]);
return match (
$response
->
status
()) {
200
=>
unserialize
(
$response
),
504
=> throw
TaskTimeoutException
::
after
(
$waitMilliseconds
),
default => throw
TaskExceptionResult
::
from
(
new
Exception
(
'Invalid response from task server.'
),
src/Swoole/SwooleHttpTaskDispatcher.php