redis

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisClientInterface

type RedisClientInterface interface {
	Get(ctx context.Context, key string) *redis.StringCmd
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
}

RedisClientInterface defines the interface for interacting with Redis.

type RedisLoginCheckRepository

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

RedisLoginCheckRepository is a repository implementation that uses Redis for login time checks.

func NewLoginCheckRepository

func NewLoginCheckRepository(client RedisClientInterface) *RedisLoginCheckRepository

NewLoginCheckRepository creates a new instance of RedisLoginCheckRepository.

func (*RedisLoginCheckRepository) GetLoginTime

func (r *RedisLoginCheckRepository) GetLoginTime(ctx context.Context, account string) (time.Time, error)

GetLoginTime retrieves the login time for a given account from Redis. It takes a context and the account as input parameters. It returns the login time as a time.Time value and an error, if any.

func (*RedisLoginCheckRepository) SetLoginTime

func (r *RedisLoginCheckRepository) SetLoginTime(ctx context.Context, account string) (bool, error)

SetLoginTime sets the login time for a given account in Redis. It takes a context and the account as input parameters. It returns a boolean indicating whether the operation was successful and an error, if any.

Jump to

Keyboard shortcuts

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