internal

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRedisDSN added in v1.2.0

func ParseRedisDSN(url string) (*dsnInfo, error)

func RegisterCacheDriver

func RegisterCacheDriver(driverName string, creator CacheCreator)

Types

type CacheConfig

type CacheConfig struct {
	Enable bool          `json:"enable"`
	Alias  string        `json:"alias"`
	Driver string        `json:"driver"`
	Dsn    string        `json:"dsn"`
	TTL    time.Duration `json:"ttl"`
}

type CacheCreator

type CacheCreator func(config *CacheConfig) Cacher

func CacheDriver

func CacheDriver(driver string) (CacheCreator, bool)

type Cacher

type Cacher interface {
	// update value's expire time to timeout
	Touch(key string, timeout time.Duration) error
	// Get cached value by key.
	Get(key string) (interface{}, error)
	// Put cached value with key and expire time.
	Put(key string, val interface{}, timeout time.Duration) error
	// Increment cached int value by key, as a counter.
	Increment(key string) error
	// Decrement cached int value by key, as a counter.
	Decrement(key string) error
	// Delete cached value by key.
	Delete(key string) error
	// Clear all cache.
	ClearAll() error
	// Get cached Json value by key.
	GetJson(key string, val interface{}) error
	// Put Json value with key and expire time
	PutJson(key string, val interface{}, timeout time.Duration) error
}

type UrlInfo

type UrlInfo struct {
	Addr    string
	Options map[string]string
}

func ExtractURL

func ExtractURL(s string) (*UrlInfo, error)

Jump to

Keyboard shortcuts

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