go_cache

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 9 Imported by: 0

README

go-cache

Go Cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

func NewMemory

func NewMemory(defaultExpiration, cleanupInterval time.Duration) *Memory

func (*Memory) Del

func (c *Memory) Del(ctx context.Context, key string) error

func (*Memory) Exists

func (c *Memory) Exists(ctx context.Context, key string) bool

func (*Memory) ExpiresAt

func (c *Memory) ExpiresAt(ctx context.Context, key string, expiresAt time.Time) error

func (*Memory) ExpiresIn

func (c *Memory) ExpiresIn(ctx context.Context, key string, ttl time.Duration) error

func (*Memory) Get

func (c *Memory) Get(ctx context.Context, key string, obj any) error

func (*Memory) GetSet

func (c *Memory) GetSet(ctx context.Context, key string, ttl time.Duration, obj any, fun gsr.CacheCallback) error

func (*Memory) Set

func (c *Memory) Set(ctx context.Context, key string, value any, ttl time.Duration) error

type None

type None struct {
}

func NewCacheNone

func NewCacheNone() *None

func NewNone added in v1.0.1

func NewNone() *None

func (*None) Del

func (c *None) Del(ctx context.Context, key string) error

func (*None) Exists

func (c *None) Exists(ctx context.Context, key string) bool

func (*None) ExpiresAt

func (c *None) ExpiresAt(ctx context.Context, key string, expiresAt time.Time) error

func (*None) ExpiresIn

func (c *None) ExpiresIn(ctx context.Context, key string, ttl time.Duration) error

func (*None) Get

func (c *None) Get(ctx context.Context, key string, obj any) error

func (*None) GetSet

func (c *None) GetSet(ctx context.Context, key string, ttl time.Duration, obj any, fun gsr.CacheCallback) error

func (*None) Set

func (c *None) Set(ctx context.Context, key string, value any, ttl time.Duration) error

type Redis

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

func NewRedis

func NewRedis(conn *redis.Client) *Redis

func (*Redis) Del

func (c *Redis) Del(ctx context.Context, key string) error

func (*Redis) Exists

func (c *Redis) Exists(ctx context.Context, key string) bool

func (*Redis) ExpiresAt

func (c *Redis) ExpiresAt(ctx context.Context, key string, expiresAt time.Time) error

func (*Redis) ExpiresIn

func (c *Redis) ExpiresIn(ctx context.Context, key string, ttl time.Duration) error

func (*Redis) Get

func (c *Redis) Get(ctx context.Context, key string, obj any) error

func (*Redis) GetSet

func (c *Redis) GetSet(ctx context.Context, key string, ttl time.Duration, obj any, fun gsr.CacheCallback) error

func (*Redis) Set

func (c *Redis) Set(ctx context.Context, key string, value any, ttl time.Duration) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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