cache

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheInterface

type CacheInterface interface {
	Init(cacheDuration time.Duration)
	Get(cacheKey string) (interface{}, bool)
	Set(cacheKey string, item interface{})
	GetItemTTL(cacheKey string) (time.Duration, bool)
	GetTTL() time.Duration
	ExtendTTL(cacheKey string, item interface{})
}
var CacheInstance CacheInterface

type GoCache

type GoCache struct {
	Cache *gocache.Cache
	TTL   time.Duration
}

func (*GoCache) ExtendTTL

func (c *GoCache) ExtendTTL(cacheKey string, item interface{})

func (*GoCache) Get

func (c *GoCache) Get(cacheKey string) (interface{}, bool)

func (*GoCache) GetItemTTL

func (c *GoCache) GetItemTTL(cacheKey string) (time.Duration, bool)

func (*GoCache) GetTTL

func (c *GoCache) GetTTL() time.Duration

func (*GoCache) Init

func (c *GoCache) Init(cacheDuration time.Duration)

func (*GoCache) Set

func (c *GoCache) Set(cacheKey string, item interface{})

type RedisCache

type RedisCache struct {
	Cache   *redis.Client
	TTL     time.Duration
	CTX     context.Context
	Address string
	DB      int
}

func (*RedisCache) ExtendTTL

func (c *RedisCache) ExtendTTL(cacheKey string, item interface{})

func (*RedisCache) Get

func (c *RedisCache) Get(cacheKey string) (interface{}, bool)

func (*RedisCache) GetItemTTL

func (c *RedisCache) GetItemTTL(cacheKey string) (time.Duration, bool)

func (*RedisCache) GetTTL

func (c *RedisCache) GetTTL() time.Duration

func (*RedisCache) Init

func (c *RedisCache) Init(cacheDuration time.Duration)

func (*RedisCache) Set

func (c *RedisCache) Set(cacheKey string, item interface{})

Jump to

Keyboard shortcuts

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