rdbedis

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

README

RDBedis

GitHub go.mod Go version of a Go module CodeFactor Go Report Card Github tag GitHub issues GPLv3 license

A small redis package to handle multiple redis connections easier.

Install

Use the go commandline tool to install the package to your go project.

go get github.com/jnnkrdb/rdbedis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {
	URI  string `json:"uri"`
	Port string `json:"port"`
	// paswword must be base64
	Password string `json:"password"`
	DBIndex  int    `json:"dbindex"`
	// contains filtered or unexported fields
}

Struct of the redis-configuration as json. Ensure the "passwd" value is base64 encrypted.

{
  "address" : "redis:port",
  "passwd" : "<password>",
  "dbindex" : 0
}

func (Redis) Add

func (rds Redis) Add(key, value string, expirationtime int) error

add a key value (plus duration) pair to the redis instance

Parameters:

  • `key` : string > used as the address of the value
  • `value` : string > contains the value, of the key
  • `expirationtime` : int > expiration time of the key-value-pair, 0 means it does not expire

func (*Redis) CheckConnection

func (rds *Redis) CheckConnection() error

check the connection to redis

func (*Redis) Connect

func (rds *Redis) Connect()

connect to the redis from the config

func (Redis) Delete

func (rds Redis) Delete(key string) error

delete a specific key from the redis instance DOES NOT WORK NOW

Parameters:

  • `key` : string > used to address the value

func (Redis) Read

func (rds Redis) Read(key string) (string, error)

read a specific key from the redis instance

Parameters:

  • `key` : string > used to address the value

Jump to

Keyboard shortcuts

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