server

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(cfg *YAxCConfig) (s *yAxCServer)

Types

type Backend

type Backend interface {
	Get(key string) (string, error)
	Set(key, value string, ttl time.Duration) error

	GetHash(key string) (string, error)
	SetHash(key, value string, ttl time.Duration) error
}

type CacheBackend

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

func (*CacheBackend) Get

func (b *CacheBackend) Get(key string) (res string, err error)

func (*CacheBackend) GetHash

func (b *CacheBackend) GetHash(key string) (res string, err error)

func (*CacheBackend) Set

func (b *CacheBackend) Set(key, value string, ttl time.Duration) error

func (*CacheBackend) SetHash

func (b *CacheBackend) SetHash(key, value string, ttl time.Duration) error

type RedisBackend

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

func (*RedisBackend) Get

func (b *RedisBackend) Get(key string) (res string, err error)

func (*RedisBackend) GetHash

func (b *RedisBackend) GetHash(key string) (res string, err error)

func (*RedisBackend) Set

func (b *RedisBackend) Set(key, value string, ttl time.Duration) (err error)

func (*RedisBackend) SetHash

func (b *RedisBackend) SetHash(key, value string, ttl time.Duration) (err error)

type YAxCConfig

type YAxCConfig struct {
	// Address
	BindAddress string // required
	// Redis
	RedisAddress   string // "" -> only use cache
	RedisPassword  string
	RedisDatabase  int
	RedisPrefixVal string
	RedisPrefixHsh string
	// Timeout
	DefaultTTL time.Duration // 0 -> infinite
	MinTTL     time.Duration // == MaxTTL -> cannot specify TTL
	MaxTTL     time.Duration // == MinTTL -> cannot specify TTL
	// Other
	MaxBodyLength    int
	EnableEncryption bool
	ProxyHeader      string
}

Jump to

Keyboard shortcuts

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