Documentation
¶
Index ¶
- Variables
- func AllCacheTypes() []maps.Map
- func FindType(typeCode string) maps.Map
- func FindTypeName(typeCode string) string
- func ProcessAfterRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
- func ProcessBeforeRequest(req *teaproxy.Request, writer *teaproxy.ResponseWriter) bool
- func ResetCachePolicyManager(filename string)
- type FileManager
- func (this *FileManager) Clean() error
- func (this *FileManager) Close() error
- func (this *FileManager) Delete(key string) error
- func (this *FileManager) Read(key string) (data []byte, err error)
- func (this *FileManager) SetOptions(options map[string]interface{})
- func (this *FileManager) Stat() (size int64, countKeys int, err error)
- func (this *FileManager) Write(key string, data []byte) error
- type Item
- type LevelDBManager
- func (this *LevelDBManager) Clean() error
- func (this *LevelDBManager) CleanExpired() error
- func (this *LevelDBManager) Close() error
- func (this *LevelDBManager) Delete(key string) error
- func (this *LevelDBManager) Read(key string) (data []byte, err error)
- func (this *LevelDBManager) SetOptions(options map[string]interface{})
- func (this *LevelDBManager) Stat() (size int64, countKeys int, err error)
- func (this *LevelDBManager) Write(key string, data []byte) error
- type Manager
- type ManagerInterface
- type MemoryManager
- func (this *MemoryManager) Clean() error
- func (this *MemoryManager) Close() error
- func (this *MemoryManager) Delete(key string) error
- func (this *MemoryManager) Read(key string) (data []byte, err error)
- func (this *MemoryManager) SetOptions(options map[string]interface{})
- func (this *MemoryManager) Stat() (size int64, countKeys int, err error)
- func (this *MemoryManager) Write(key string, data []byte) error
- type RedisManager
- func (this *RedisManager) Clean() error
- func (this *RedisManager) Close() error
- func (this *RedisManager) Delete(key string) error
- func (this *RedisManager) Read(key string) (data []byte, err error)
- func (this *RedisManager) SetOptions(options map[string]interface{})
- func (this *RedisManager) Stat() (size int64, countKeys int, err error)
- func (this *RedisManager) Write(key string, data []byte) error
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 {
Manager
Capacity float64 // 容量
Life time.Duration // 有效期
// contains filtered or unexported fields
}
文件缓存管理器
func NewFileManager ¶
func NewFileManager() *FileManager
func (*FileManager) Close ¶ added in v0.1.2
func (this *FileManager) Close() error
func (*FileManager) SetOptions ¶
func (this *FileManager) SetOptions(options map[string]interface{})
type LevelDBManager ¶ added in v0.1.2
type LevelDBManager struct {
Manager
Capacity float64 // 容量
Life time.Duration // 有效期
// contains filtered or unexported fields
}
Leveldb缓存管理器
func NewLevelDBManager ¶ added in v0.1.2
func NewLevelDBManager() *LevelDBManager
func (*LevelDBManager) CleanExpired ¶ added in v0.1.2
func (this *LevelDBManager) CleanExpired() error
func (*LevelDBManager) Delete ¶ added in v0.1.2
func (this *LevelDBManager) Delete(key string) error
删除
func (*LevelDBManager) Read ¶ added in v0.1.2
func (this *LevelDBManager) Read(key string) (data []byte, err error)
func (*LevelDBManager) SetOptions ¶ added in v0.1.2
func (this *LevelDBManager) SetOptions(options map[string]interface{})
type ManagerInterface ¶
type ManagerInterface interface {
// 设置ID
SetId(id string)
// 写入
Write(key string, data []byte) error
// 读取
Read(key string) (data []byte, err error)
// 删除
Delete(key string) error
// 设置选项
SetOptions(options map[string]interface{})
// 统计
Stat() (size int64, countKeys int, err error)
// 清理
Clean() error
// 关闭
Close() error
}
缓存管理接口
func FindCachePolicyManager ¶ added in v0.1.2
func FindCachePolicyManager(filename string) ManagerInterface
获取管理器
func NewManagerFromConfig ¶
func NewManagerFromConfig(config *shared.CachePolicy) ManagerInterface
获取新的管理对象
type MemoryManager ¶
type MemoryManager struct {
Manager
Capacity float64 // 容量
Life time.Duration // 有效期
// contains filtered or unexported fields
}
内存缓存管理器
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) Delete ¶ added in v0.1.2
func (this *MemoryManager) Delete(key string) error
删除
func (*MemoryManager) SetOptions ¶
func (this *MemoryManager) SetOptions(options map[string]interface{})
type RedisManager ¶
type RedisManager struct {
Manager
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.