func (c Client) AddToSortedSet(key BaseRedisKey, score int, element string) error {
	conn := c.getConnection()
	_, err := conn.Do("ZADD", key, score, element)
	if err != nil {
		return fmt.Errorf("could not ZADD key %s: %w", key, err)
	}
	return nil
}
AddToSortedSet adds a element to a redis sorted set. The interger score
defines the position in the sorted set.

Note: Redis supports double precision for scores, but that's not implemented
here yet. Additionally Redis supports multiple insertions in one call. That's
not implemented here either.
package redis
import (
	"fmt"
	"log"
	"github.com/digitalbitbox/bitbox-base/middleware/src/rpcmessages"
	"github.com/gomodule/redigo/redis"
)
type Redis interface {
	ConvertErrorToErrorResponse(error) rpcmessages.ErrorResponse
	GetBool(key BaseRedisKey) (bool, error)
	GetInt(BaseRedisKey) (int, error)
	GetString(BaseRedisKey) (string, error)
	SetString(BaseRedisKey, string) error
	AddToSortedSet(BaseRedisKey, int, string) error
	RemoveFromSortedSet(BaseRedisKey, string) error
	GetTopFromSortedSet(BaseRedisKey) (string, error)
}
type Client struct {
	pool *redis.Pool
}
func NewClient(port string) (client Client) {
	pool := newPool(port)
	err := ping(pool.Get())
	if err != nil {
		log.Printf("Warning redis server connectivity could not be established: %s", err.Error())
	}
	return Client{pool: pool}
}
func newPool(port string) *redis.Pool {
	return &redis.Pool{
		MaxIdle:   80,
		MaxActive: 12000,
		Dial: func() (redis.Conn, error) {
			conn, err := redis.Dial("tcp", "localhost"+":"+port)
			if err != nil {
				return nil, err
			}
			return conn, err
		},
	}
}
func ping(c redis.Conn) (err error) {
	defer func() {
		err := c.Close()
		if err != nil {
			log.Println("error when closing redis connection after ping. This is not critical and we can continue running")
		}
	}()
	_, err = c.Do("PING")
	if err != nil {
		return
	}
	return
}
func (c Client) getConnection() redis.Conn {
	return c.pool.Get()
}
func (c Client) GetInt(key BaseRedisKey) (val int, err error) {
	conn := c.getConnection()
	val, err = redis.Int(conn.Do("GET", key))
	if err != nil {
		return -1, fmt.Errorf("could not get key %s as integer: %s", key, err.Error())
	}
	return val, nil
}
func (c Client) GetBool(key BaseRedisKey) (val bool, err error) {
	conn := c.getConnection()
	valAsInt, err := redis.Int(conn.Do("GET", key))
	if err != nil {
		return false, fmt.Errorf("could not get key %s as boolean: %s", key, err.Error())
	}
	return valAsInt == 1, nil
}
func (c Client) GetString(key BaseRedisKey) (val string, err error) {
	conn := c.getConnection()
	val, err = redis.String(conn.Do("GET", key))
	if err != nil {
		return "", fmt.Errorf("could not get key %s as string: %s", key, err.Error())
	}
	return val, nil
}
func (c Client) SetString(key BaseRedisKey, value string) error {
	conn := c.getConnection()
	_, err := conn.Do("SET", key, value)
	if err != nil {
		return fmt.Errorf("could not set key %s: %s", key, err.Error())
	}
	return nil
}