You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement token based paging in my project's API but it doesn't look like the page_state result metadata is exposed by Cassandra\Response\Result. Is there a recommended way to capture this value so my clients can request the next page at a later time?
For now I'm using the following hack to work around this:
$pageState = null;
while (true) {
/** @var Result $res */$res = $cass->querySync('SELECT "key" FROM message', [], null, ['page_size' => 10, 'paging_state' => $pageState]);
yield from $res->fetchCol();
$pageState = CassandraResultMetadataAccessor::getPageState($res);
if (!$pageState) break;
echo'DEBUG: paging token for client: ' . base64_encode($pageState) . "\n";
}
classCassandraResultMetadataAccessorextendsResult
{
publicstaticfunctiongetPageState(Result$res) {
return$res->_metadata['page_state'] ?? null;
}
}
The text was updated successfully, but these errors were encountered:
OK, it looks like this has already been fixed in master, it's just that the most recent release v0.5.2 is 84 commits behind despite this project having no activity in the last 3.5 years. So I guess I'll try my chances with the latest unreleased code (I also need the unreleased Tuple support). My workaround above still applies if you're using the official release.
I'm trying to implement token based paging in my project's API but it doesn't look like the
page_state
result metadata is exposed byCassandra\Response\Result
. Is there a recommended way to capture this value so my clients can request the next page at a later time?For now I'm using the following hack to work around this:
The text was updated successfully, but these errors were encountered: