services

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ENV_MEMCACHED_ADDRESS = os.Getenv("ENV_MEMCACHED_ADDRESS")
View Source
var ENV_REDIS_ADDRESS = os.Getenv("ENV_REDIS_ADDRESS")

Functions

This section is empty.

Types

type MemcachedService

type MemcachedService struct {
	Cache *memcache.Client
}

func NewMemcachedService

func NewMemcachedService() *MemcachedService

func (*MemcachedService) Acquire

func (ms *MemcachedService) Acquire(lock *lib.Lock) (*lib.Lock, error)

func (*MemcachedService) Release

func (ms *MemcachedService) Release(lock *lib.Lock) (*lib.Lock, error)

type RedisService

type RedisService struct {
	// contains filtered or unexported fields
}
RedisService:

// A service for creating distributed locks in Redis

func NewRedisService

func NewRedisService() *RedisService
NewRedisService:

Creates a new Redis Service to allow redis locks.

Returns:

*RedisService

func (*RedisService) Acquire

func (rs *RedisService) Acquire(lock *lib.Lock) (*lib.Lock, error)
Acquire a distributed lock in Redis

Parameters:

  • identifier (string): // Unique name for the lock
  • ttl (time.Duration): // Self-expiry for the lock.

func (*RedisService) Release

func (rs *RedisService) Release(lock *lib.Lock) (*lib.Lock, error)
Release a distributed lock in Redis

Parameters:

  • identifier (string): // Unique name of the lock

Jump to

Keyboard shortcuts

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