Pagination
Redis has no general page-number query. For a List, LRANGE reads an inclusive range by position and LLEN returns its length:
LRANGE article:recent 10 19
LLEN article:recent
dbVisitor Usage
int pageNumber = 1;
int pageSize = 10;
long start = (long) pageNumber * pageSize;
List<String> rows = jdbc.queryForList(
"LRANGE ? ? ?",
new Object[] { "article:recent", start, start + pageSize - 1 },
String.class);
Long total = jdbc.queryForLong("LLEN ?", "article:recent");
This fetches the second page directly from Redis. Do not pass a Page argument: Redis has no dbVisitor pagination dialect. For a sorted set, use ZRANGE with rank bounds and ZCARD for the total.
Notes
Concurrent list changes can shift positions; the total and range are separate reads. SCAN is cursor traversal, not page-number pagination, and COUNT does not guarantee a batch size.
Note
The current adapter attaches the cursor to each SCAN result row. An empty batch exposes no cursor, and COUNT may truncate returned rows. Do not use this path for a complete, lossless key scan; use the Redis client directly for that task.