redission

package module
v0.0.0-...-0ecada8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-reidssion

Quickstart

package main

import (
	"net/http"
	"time"

	"github.com/gin-gonic/gin"
	"github.com/go-redis/redis"
	"github.com/lvnz555/go-redission"
)

func main() {
  rdb := redis.NewClient(&redis.Options{
	Network:     "tcp",
	Addr:        "127.0.0.1:6379",
	PoolSize:    50,
	DialTimeout: 10 * time.Second,
  })

  locker := redission.GetLocker(rdb, &redission.RedissionLockConfig{
	Key: "pro:001",
  })

  locker.Lock(context.Background())
  // ---
  locker.UnLock()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocker

func GetLocker(client *redis.Client, ops *RedissionLockConfig) *redissionLocker

func GetReadLocker

func GetReadLocker(client *redis.Client, ops *RedissionLockConfig) *redissionReadLocker

func GetWriteLocker

func GetWriteLocker(client *redis.Client, ops *RedissionLockConfig) *redissionWriteLocker

func SetLogger

func SetLogger(logger *log.Logger)

Types

type RedissionLockConfig

type RedissionLockConfig struct {
	LockLeaseTime time.Duration
	Prefix        string
	ChanPrefix    string
	Key           string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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