cache

package
v0.0.0-...-c302505 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
	Delete(ctx context.Context, key string) error
	Exists(ctx context.Context, key string) (bool, error)
	Flush(ctx context.Context) error
	Ping(ctx context.Context) error
}

type RedisCache

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

func NewRedisCache

func NewRedisCache(addr, password string, db int) (*RedisCache, error)

func (*RedisCache) Delete

func (r *RedisCache) Delete(ctx context.Context, key string) error

func (*RedisCache) Exists

func (r *RedisCache) Exists(ctx context.Context, key string) (bool, error)

func (*RedisCache) Flush

func (r *RedisCache) Flush(ctx context.Context) error

func (*RedisCache) Get

func (r *RedisCache) Get(ctx context.Context, key string) (string, error)

func (*RedisCache) Ping

func (r *RedisCache) Ping(ctx context.Context) error

func (*RedisCache) Set

func (r *RedisCache) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error

type SessionCache

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

func NewSessionCache

func NewSessionCache(cache Cache) *SessionCache

func (*SessionCache) GetSession

func (sc *SessionCache) GetSession(ctx context.Context, sessionID string) (*model.Session, error)

func (*SessionCache) InvalidateSession

func (sc *SessionCache) InvalidateSession(ctx context.Context, sessionID string) error

func (*SessionCache) SetSession

func (sc *SessionCache) SetSession(ctx context.Context, sessionID string, data model.Session) error

type UserCache

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

func NewUserCache

func NewUserCache(cache Cache) *UserCache

func (*UserCache) GetUser

func (uc *UserCache) GetUser(ctx context.Context, id int64) (*model.User, error)

func (*UserCache) GetUsers

func (uc *UserCache) GetUsers(ctx context.Context) ([]model.User, error)

func (*UserCache) GetVerificationCode

func (uc *UserCache) GetVerificationCode(ctx context.Context, email string) (string, error)

func (*UserCache) InvalidateUser

func (uc *UserCache) InvalidateUser(ctx context.Context, id int64) error

func (*UserCache) InvalidateUsersList

func (uc *UserCache) InvalidateUsersList(ctx context.Context) error

func (*UserCache) SaveVerificationCode

func (uc *UserCache) SaveVerificationCode(ctx context.Context, email string, code string) error

func (*UserCache) SetUser

func (uc *UserCache) SetUser(ctx context.Context, user *model.User) error

func (*UserCache) SetUsers

func (uc *UserCache) SetUsers(ctx context.Context, users []model.User) error

Jump to

Keyboard shortcuts

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