mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-06-06 22:49:43 +00:00
e64fc7f730
* Add redis support for distributed caching * Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * ... and another all nighter. * fixup! ... and another all nighter. * fixup! fixup! ... and another all nighter. * fixup! fixup! fixup! ... and another all nighter. * Resolve issue #85 by adding ability to set custom claims in JWT tokens * Remove redundant validation in auth middleware ( issue #89 ) * Add ability to set cookie prefix for session cookies ( #87 ) * fixup! Add ability to set cookie prefix for session cookies ( #87 ) * Add ability to set cookie max age - issue #91 * Potential fix for code scanning alert no. 10: Size computation for allocation may overflow Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fixup! Merge main into 0.8.0-redis: resolve conflicts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
67 lines
1.2 KiB
Go
67 lines
1.2 KiB
Go
package redis
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// ScanIterator is used to incrementally iterate over a collection of elements.
|
|
type ScanIterator struct {
|
|
cmd *ScanCmd
|
|
pos int
|
|
}
|
|
|
|
// Err returns the last iterator error, if any.
|
|
func (it *ScanIterator) Err() error {
|
|
return it.cmd.Err()
|
|
}
|
|
|
|
// Next advances the cursor and returns true if more values can be read.
|
|
func (it *ScanIterator) Next(ctx context.Context) bool {
|
|
// Instantly return on errors.
|
|
if it.cmd.Err() != nil {
|
|
return false
|
|
}
|
|
|
|
// Advance cursor, check if we are still within range.
|
|
if it.pos < len(it.cmd.page) {
|
|
it.pos++
|
|
return true
|
|
}
|
|
|
|
for {
|
|
// Return if there is no more data to fetch.
|
|
if it.cmd.cursor == 0 {
|
|
return false
|
|
}
|
|
|
|
// Fetch next page.
|
|
switch it.cmd.args[0] {
|
|
case "scan", "qscan":
|
|
it.cmd.args[1] = it.cmd.cursor
|
|
default:
|
|
it.cmd.args[2] = it.cmd.cursor
|
|
}
|
|
|
|
err := it.cmd.process(ctx, it.cmd)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
it.pos = 1
|
|
|
|
// Redis can occasionally return empty page.
|
|
if len(it.cmd.page) > 0 {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
|
|
// Val returns the key/field at the current cursor position.
|
|
func (it *ScanIterator) Val() string {
|
|
var v string
|
|
if it.cmd.Err() == nil && it.pos > 0 && it.pos <= len(it.cmd.page) {
|
|
v = it.cmd.page[it.pos-1]
|
|
}
|
|
return v
|
|
}
|