$now =
time();
$expired =
[];
$sql = "SELECT
$this->idCol, CASE WHEN
$this->lifetimeCol IS NULL OR
$this->lifetimeCol +
$this->timeCol > ? THEN
$this->dataCol ELSE NULL END FROM
$this->table WHERE
$this->idCol IN (?)";
$result =
$this->conn->
executeQuery($sql,
[ $now,
$ids,
],
[ ParameterType::INTEGER,
class_exists(ArrayParameterType::
class) ? ArrayParameterType::STRING : Connection::PARAM_STR_ARRAY,
])->
iterateNumeric();
foreach ($result as $row) { if (null ===
$row[1
]) { $expired[] =
$row[0
];
} else { yield $row[0
] =>
$this->marshaller->
unmarshall(\
is_resource($row[1
]) ?
stream_get_contents($row[1
]) :
$row[1
]);
} } if ($expired) { $sql = "DELETE FROM
$this->table WHERE
$this->lifetimeCol +
$this->timeCol <= ? AND
$this->idCol IN (?)";