Documentation
¶
Index ¶
- Variables
- func AllCacheTypes() []maps.Map
- func ProcessAfterRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
- func ProcessBeforeRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
- func TypeName(typeCode string) string
- type FileManager
- type Item
- type ManagerInterface
- type MemoryManager
- type RedisManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("cache not found")
Functions ¶
func ProcessAfterRequest ¶
func ProcessAfterRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
func ProcessBeforeRequest ¶
func ProcessBeforeRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
Types ¶
type FileManager ¶
type FileManager struct {
Capacity float64 // 容量
Life time.Duration // 有效期
// contains filtered or unexported fields
}
文件缓存管理器
func NewFileManager ¶
func NewFileManager() *FileManager
func (*FileManager) Read ¶
func (this *FileManager) Read(key string) (data []byte, err error)
func (*FileManager) SetOptions ¶
func (this *FileManager) SetOptions(options map[string]interface{})
func (*FileManager) Write ¶
func (this *FileManager) Write(key string, data []byte) error
type ManagerInterface ¶
type ManagerInterface interface {
// 写入
Write(key string, data []byte) error
// 读取
Read(key string) (data []byte, err error)
// 设置选项
SetOptions(options map[string]interface{})
}
缓存管理接口
func NewManagerFromConfig ¶
func NewManagerFromConfig(config *shared.CachePolicy) ManagerInterface
获取新的管理对象
type MemoryManager ¶
type MemoryManager struct {
Capacity float64 // 容量
Life time.Duration // 有效期
// contains filtered or unexported fields
}
内存缓存管理器
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) SetOptions ¶
func (this *MemoryManager) SetOptions(options map[string]interface{})
type RedisManager ¶
type RedisManager struct {
Capacity float64 // 容量
Life time.Duration // 有效期
Network string
Host string
Port int
Password string
Sock string
// contains filtered or unexported fields
}
内存缓存管理器
func NewRedisManager ¶
func NewRedisManager() *RedisManager
func (*RedisManager) SetOptions ¶
func (this *RedisManager) SetOptions(options map[string]interface{})
Click to show internal directories.
Click to hide internal directories.