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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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