cache

package
v0.0.0-...-4e5a236 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cache implements a REDIS cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) (interface{}, error)
	Set(key string, value interface{}) error
	GetJSON(key string, value interface{}) error
	SetJSON(key string, value interface{}) error
}

func NewRedisCache

func NewRedisCache(addr string) (Cache, error)

type RedisCache

type RedisCache struct {
	// contains filtered or unexported fields
}

func (*RedisCache) Get

func (rc *RedisCache) Get(key string) (interface{}, error)

Get retrieves a value from the cache.

func (*RedisCache) GetJSON

func (rc *RedisCache) GetJSON(key string, value interface{}) error

GetJSON retrieves a JSON string and unmarshals it into the given interface.

func (*RedisCache) Set

func (rc *RedisCache) Set(key string, value interface{}) error

Set stores a value in the cache.

func (*RedisCache) SetJSON

func (rc *RedisCache) SetJSON(key string, value interface{}) error

SetJSON stores a struct as a JSON string.

Jump to

Keyboard shortcuts

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