cache

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerCache

type BadgerCache struct {
	Connection *badger.DB
	Prefix     string
}

func (*BadgerCache) Clean

func (b *BadgerCache) Clean() error

func (*BadgerCache) Delete

func (b *BadgerCache) Delete(str string) error

func (*BadgerCache) DeleteIfMatch

func (b *BadgerCache) DeleteIfMatch(str string) error

func (*BadgerCache) Exists

func (b *BadgerCache) Exists(str string) (bool, error)

func (*BadgerCache) Get

func (b *BadgerCache) Get(str string) (interface{}, error)

func (*BadgerCache) Set

func (b *BadgerCache) Set(str string, value interface{}, expires ...int) error

type Cache

type Cache interface {
	Exists(string) (bool, error)
	Get(string) (interface{}, error)
	Set(string, interface{}, ...int) error
	Delete(string) error
	DeleteIfMatch(string) error
	Clean() error
}

type Entry

type Entry map[string]interface{}

type RedisCache

type RedisCache struct {
	Connection *redis.Pool
	Prefix     string
}

func (*RedisCache) Clean

func (c *RedisCache) Clean() error

Clean : Delete all entries from redis.

func (*RedisCache) Delete

func (c *RedisCache) Delete(str string) error

Delete : Delete a key value in Redis.

func (*RedisCache) DeleteIfMatch

func (c *RedisCache) DeleteIfMatch(str string) error

DeleteIfMatch : Delete a key values where match the with the key value

func (*RedisCache) Exists

func (c *RedisCache) Exists(str string) (bool, error)

Exists : Check if the key exists

func (*RedisCache) Get

func (c *RedisCache) Get(str string) (interface{}, error)

Get : Return Key values from Redis if it exists.

func (*RedisCache) Set

func (c *RedisCache) Set(str string, value interface{}, expires ...int) error

Set : Set a key value in Redis

Jump to

Keyboard shortcuts

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