func (s *Server) RedisScanOrders(ctx context.Context) ([]int64, error) {
	span, _ := ot.StartSpanFromContext(ctx, "RedisScanOrders")
	defer span.Finish()
	var cursor uint64
	var keys []int64
	var err error
	for {
		var ks []string
		ks, cursor, err = s.redis.Scan(cursor, fmt.Sprintf("%s:*", orderKeyNamespace), 10).Result()
		if err != nil {
			return nil, err
		}
		for _, k := range ks {
			id, err := strconv.ParseInt(removeNamespace(k), 10, 64)
			if err != nil {
				return nil, err
			}
			keys = append(keys, id)
		}
		if cursor == 0 {
			break
		}
	}
	return keys, err
}
RedisScanOrders retrieves the IDs (keys) of all orders.
package order
import (
	"context"
	"fmt"
	"strconv"
	"strings"
	ot "github.com/opentracing/opentracing-go"
	"github.com/pkg/errors"
)
func appendNamespace(id string) string {
	return fmt.Sprintf("%s:%s", orderKeyNamespace, id)
}
func removeNamespace(key string) string {
	str := strings.Split(key, ":")[1:]
	return strings.Join(str, "")
}