Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteSingleCall(ctx context.Context, name string, call SingleCall) error
- func InitSingleCall(ctx context.Context, name string) error
- func Nonce(ctx context.Context, name string, nonce uint64) (uint64, error)
- func OptionArgs(args *RedisOptions)
- func RedisMutexContext(ctx context.Context) context.Context
- func ResetNonce(ctx context.Context, name string) error
- func ToRedis(cache Cache) *redis.Client
- func WithCache(ctx context.Context, cache Cache) context.Context
- type Cache
- type Lock
- func LockAccount(ctx context.Context, accountID uint64) (Lock, error)
- func LockBatchNetwork(ctx context.Context, batchNetwork string) (Lock, error)
- func LockChain(ctx context.Context, chain string) (Lock, error)
- func LockGeneric(ctx context.Context, name string) (Lock, error)
- func LockUser(ctx context.Context, userID uint64) (Lock, error)
- type Mutex
- type RDB
- type Redis
- type RedisLock
- type RedisMutex
- type RedisOptions
- type SingleCall
Constants ¶
View Source
const ( CacheKey = "Key.CacheKey" RedisLockerKey = "Key.RedisLockerKey" )
View Source
const ( DefaultLockTTL = 30 * time.Second MinimumLockTTL = 100 * time.Millisecond MaximumLockTTL = 5 * time.Minute )
View Source
const (
DefaultNonceExpire = time.Duration(3 * time.Minute)
)
Variables ¶
View Source
var ( ErrRedisMutexNotFound = errors.New("RedisMutex Not Found") ErrLockError = errors.New("Failed to acquire lock") )
View Source
var (
ErrInternalError = errors.New("InternalError")
)
View Source
var (
ErrInvaliNonceName = errors.New("Invalid nonce name")
)
Functions ¶
func ExecuteSingleCall ¶ added in v0.0.5
func ExecuteSingleCall(ctx context.Context, name string, call SingleCall) error
func OptionArgs ¶
func OptionArgs(args *RedisOptions)
func RedisMutexContext ¶ added in v0.0.3
Types ¶
type Lock ¶ added in v0.0.3
type Lock interface {
Unlock()
}
func LockAccount ¶ added in v0.0.3
func LockBatchNetwork ¶ added in v0.0.5
type Mutex ¶ added in v0.0.3
func NewRedisMutex ¶ added in v0.0.3
func RedisMutexFromContext ¶ added in v0.0.3
type RedisLock ¶ added in v0.0.3
type RedisLock struct {
// contains filtered or unexported fields
}
type RedisMutex ¶ added in v0.0.3
type RedisMutex struct {
// contains filtered or unexported fields
}
type RedisOptions ¶
type SingleCall ¶ added in v0.0.5
Click to show internal directories.
Click to hide internal directories.