Documentation ¶
Index ¶
- Constants
- func ServiceEventKeyToFileName(svcKey model.ServiceEventKey) string
- type CacheFileInfo
- type CachePersistHandler
- func (cph *CachePersistHandler) DeleteCacheFromFile(fileName string)
- func (cph *CachePersistHandler) LoadMessageFromFile(relativeFile string, message proto.Message) error
- func (cph *CachePersistHandler) LoadPersistedServices() map[model.ServiceEventKey]CacheFileInfo
- func (cph *CachePersistHandler) SaveMessageToFile(fileName string, svcResp proto.Message)
Constants ¶
View Source
const ( // PatternService is the pattern of service name PatternService = "svc#%s#%s#%s" // CacheSuffix filesystem suffix CacheSuffix = ".json" // PatternGlob is the pattern of glob PatternGlob = "svc#?*#?*#?*" )
Variables ¶
This section is empty.
Functions ¶
func ServiceEventKeyToFileName ¶
func ServiceEventKeyToFileName(svcKey model.ServiceEventKey) string
ServiceEventKeyToFileName 服务名转化为文件名
Types ¶
type CacheFileInfo ¶
CacheFileInfo 文件信息
type CachePersistHandler ¶
type CachePersistHandler struct {
// contains filtered or unexported fields
}
CachePersistHandler 持久化工具类
func NewCachePersistHandler ¶
func NewCachePersistHandler(persistDir string, maxWriteRetry int, maxReadRetry int, retryInterval time.Duration) (*CachePersistHandler, error)
NewCachePersistHandler create persistence handler
func (*CachePersistHandler) DeleteCacheFromFile ¶
func (cph *CachePersistHandler) DeleteCacheFromFile(fileName string)
DeleteCacheFromFile 删除缓存文件
func (*CachePersistHandler) LoadMessageFromFile ¶
func (cph *CachePersistHandler) LoadMessageFromFile(relativeFile string, message proto.Message) error
LoadMessageFromFile 从相对文件中加载缓存
func (*CachePersistHandler) LoadPersistedServices ¶
func (cph *CachePersistHandler) LoadPersistedServices() map[model.ServiceEventKey]CacheFileInfo
LoadPersistedServices 加载目录中所有的缓存文件
func (*CachePersistHandler) SaveMessageToFile ¶
func (cph *CachePersistHandler) SaveMessageToFile(fileName string, svcResp proto.Message)
SaveMessageToFile 按服务来进行缓存存储
Click to show internal directories.
Click to hide internal directories.