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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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