Skip to content

Instantly share code, notes, and snippets.

@gabsn
Created September 25, 2017 15:22
Show Gist options
  • Save gabsn/e437843ff2b3741533bf1f1687935364 to your computer and use it in GitHub Desktop.
Save gabsn/e437843ff2b3741533bf1f1687935364 to your computer and use it in GitHub Desktop.
[Redis] SCAN Pattern
var (
cursor int64
items []string
)
results := make([]string, 0)
for {
values, err := redis.Values(conn.Do("SSCAN", key, cursor))
if err != nil {
return
}
values, err = redis.Scan(values, &cursor, &items)
if err != nil {
return
}
results = append(results, items)
if cursor == 0 {
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment