123456789101112131415161718192021222324252627 |
- package redis
- import (
- "context"
- "time"
- )
- // redis接口
- type RedisClient interface {
- GetString(key string) string
- GetStringWithContext(ctx context.Context, key string) string
- SetString(key string, val string, expired int) error
- SetStringWithContext(ctx context.Context, key string, val string, expired int) error
- GetHSet(key string) map[string]string
- GetHSetWithContext(ctx context.Context, key string) map[string]string
- SetHSet(key string, timeout time.Duration, val ...interface{}) error
- SetHSetWithContext(ctx context.Context, key string, timeout time.Duration, val ...interface{}) error
- Delete(key string) error
- DeleteWithContext(ctx context.Context, key string) error
- IsExist(key string) bool
- IsExistWithContext(ctx context.Context, key string) bool
- Do(commandName string, args ...interface{}) (reply interface{}, err error)
- DoWithContext(ctx context.Context, commandName string, args ...interface{}) (reply interface{}, err error)
- SetIfNotExist(key string, val string, expired int) bool // 0:设置失败,1:设置成功
- SetIfNotExistWithContext(ctx context.Context, key string, val string, expired int) error
- }
|