store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package store provides persitence layer.

Index

Constants

View Source
const DefaultDatabaseConnect = "localhost:6379"

DefaultDatabaseConnect is the default redis connect scheme ([[db:]password@]host:port)

Variables

This section is empty.

Functions

func BlockedPingBakkoff

func BlockedPingBakkoff() (pong string, err error)

BlockedPingBakkoff ping redis with backoff retry if redis is not reachabe

func Ping

func Ping() (string, error)

Ping redis server

func Setup

func Setup(cx context.Context, c string) error

Setup redis context and client

store.Setup(ctx.Background(), "db:password@host:port")
store.Setup(ctx.Background(), "0:password@localhost:6379")
store.Setup(ctx.Background(), "password@localhost:6379")
store.Setup(ctx.Background(), "localhost:6379")

Types

type Hitable

type Hitable interface {
	Add(k string, i int64)
	Top() (string, int64, error)
	Reset()
}

Hitable is the Hits interface

func NewHits

func NewHits(k string) Hitable

NewHits returns a new hits bag.

type Hits

type Hits struct {
	Key string
}

Hits is a hits bag identified by a Key

func (Hits) Add

func (h Hits) Add(k string, i int64)

Add an hit in hits bag

func (Hits) Reset

func (h Hits) Reset()

Reset deletes key of hits bag

func (Hits) Top

func (h Hits) Top() (string, int64, error)

Top returns the most popular hit in hits bag

Jump to

Keyboard shortcuts

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