Pageflow is a Go library for efficient Redis-backed pagination and sorting using Redis Sorted Sets. It provides a clean abstraction for handling paginated data with customizable page sizes and sorting directions, with MongoDB support.
- Redis-backed Pagination - Efficiently fetch data with cursor-based pagination
- Sorted Data Sets - Sort data in ascending or descending order
- Flexible Item Storage - Store items with automatic TTL management
- MongoDB Integration - Support for MongoDB ObjectIDs
- Generic Implementation - Type-safe operations using Go generics
- Performance Optimized - Designed for high-throughput applications
go get github.com/yourusername/pageflow- Items are stored in Redis using their random ID as key
- Items are added to sorted sets with timestamps as scores
- Pagination operates by fetching ranges from sorted sets
- Page boundaries are tracked using first/last page markers
- The current implementation only supports pagination based on creation date. Future releases will support not only the creation date, but any custom attribute.
- Individual items: 7 days (configurable via
INDIVIDUAL_KEY_TTL) - Sorted sets: 2 days (configurable via
SORTED_SET_TTL) - TTLs are automatically extended on access
[MIT License]