util

package
v0.0.0-...-1d6235d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util is a collection of helper functions for interacting with various parts of the radix.v2 package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(r *redis.Client, ch chan string, cmd, key, pattern string) error

Scan is a helper function for performing any of the redis *SCAN functions. It takes in a channel which keys returned by redis will be written to, and returns an error should any occur. The input channel will always be closed when Scan returns, and *must* be read until it is closed.

The key argument is only needed if cmd isn't SCAN

Example SCAN command

ch := make(chan string)
var err error
go func() {
	err = util.Scan(r, ch, "SCAN", "", "*")
}()
for key := range ch {
	// do something with key
}
if err != nil {
	// handle error
}

Example HSCAN command

ch := make(chan string)
var err error
go func() {
	err = util.Scan(r, ch, "HSCAN", "somekey", "*")
}()
for key := range ch {
	// do something with key
}
if err != nil {
	// handle error
}

func ScanCluster

func ScanCluster(c *cluster.Cluster, ch chan string, pattern string) error

ScanCluster is like Scan except it operates over a whole cluster. Unlike Scan it only works with SCAN and as such only takes in a pattern string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL