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) DeletePrefixes(prefixes []string) (int, 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) DeletePrefixes(prefixes []string) (int, 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) DeletePrefixes(prefixes []string) (int, 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) DeletePrefixes(prefixes []string) (int, 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 ¶
func (this *FileManager) Close() error
func (*FileManager) DeletePrefixes ¶
func (this *FileManager) DeletePrefixes(prefixes []string) (int, error)
删除key前缀
func (*FileManager) SetOptions ¶
func (this *FileManager) SetOptions(options map[string]interface{})
func (*FileManager) Stat ¶
func (this *FileManager) Stat() (size int64, countKeys int, err error)
统计
func (*FileManager) Write ¶
func (this *FileManager) Write(key string, data []byte) error
写入 内容格式 timestamp | key length (20 bytes) | key | data (n bytes) |
type LevelDBManager ¶
type LevelDBManager struct { Manager Capacity float64 // 容量 Life time.Duration // 有效期 // contains filtered or unexported fields }
Leveldb缓存管理器
func NewLevelDBManager ¶
func NewLevelDBManager() *LevelDBManager
func (*LevelDBManager) CleanExpired ¶
func (this *LevelDBManager) CleanExpired() error
func (*LevelDBManager) DeletePrefixes ¶
func (this *LevelDBManager) DeletePrefixes(prefixes []string) (int, error)
删除key前缀
func (*LevelDBManager) SetOptions ¶
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 // 删除key前缀 DeletePrefixes(prefixes []string) (int, error) // 设置选项 SetOptions(options map[string]interface{}) // 统计 Stat() (size int64, countKeys int, err error) // 清理 Clean() error // 关闭 Close() error }
缓存管理接口
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) DeletePrefixes ¶
func (this *MemoryManager) DeletePrefixes(prefixes []string) (int, error)
删除key前缀
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) DeletePrefixes ¶
func (this *RedisManager) DeletePrefixes(prefixes []string) (int, error)
删除key前缀
func (*RedisManager) SetOptions ¶
func (this *RedisManager) SetOptions(options map[string]interface{})
Click to show internal directories.
Click to hide internal directories.