Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
decodeKey example
protected
function
doFetch
(
array
$ids
)
: iterable
{
try
{
$encodedIds
=
array_map
(
[
__CLASS__, 'encodeKey'
]
,
$ids
)
;
$encodedResult
=
$this
->
checkResultCode
(
$this
->
getClient
(
)
->
getMulti
(
$encodedIds
)
)
;
$result
=
[
]
;
foreach
(
$encodedResult
as
$key
=>
$value
)
{
$result
[
self::
decodeKey
(
$key
)
]
=
$this
->marshaller->
unmarshall
(
$value
)
;
}
return
$result
;
}
catch
(
\Error
$e
)
{
throw
new
\
ErrorException
(
$e
->
getMessage
(
)
,
$e
->
getCode
(
)
, \E_ERROR,
$e
->
getFile
(
)
,
$e
->
getLine
(
)
)
;
}
}
protected
function
doHave
(
string
$id
)
: bool
{
return
false !==
$this
->
getClient
(
)
->
get
(
self::
encodeKey
(
$id
)
)
||
$this
->
checkResultCode
(
\Memcached::RES_SUCCESS ===
$this
->client->
getResultCode
(
)
)
;
}