redis

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 3 Imported by: 2

README

Cachego - Redis driver

The drivers uses go-redis to store the cache data.

Usage

package main

import (
	"log"
	"time"

	rd "gopkg.in/redis.v4"

	"github.com/faabiosr/cachego/redis"
)

func main() {
	cache := redis.New(
		rd.NewClient(&rd.Options{
			Addr: ":6379",
		}),
	)

	if err := cache.Save("user_id", "1", 10*time.Second); err != nil {
		log.Fatal(err)
	}

	id, err := cache.Fetch("user_id")
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("user id: %s \n", id)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(driver rd.BaseCmdable) cachego.Cache

New creates an instance of Redis cache driver

Types

This section is empty.

Jump to

Keyboard shortcuts

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