Documentation ¶
Index ¶
- Variables
- type DataBuffer
- func (m *DataBuffer) ClearDatas(method string)
- func (m *DataBuffer) DelData(method string, url string)
- func (m *DataBuffer) GC()
- func (m *DataBuffer) GetData(method string, url string) interface{}
- func (m *DataBuffer) PutData(method string, url string, obj interface{}, expired ...time.Duration)
- func (m *DataBuffer) RunGC()
- type MemoryStore
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotExist = errors.New("not exists")
)
vars
Functions ¶
This section is empty.
Types ¶
type DataBuffer ¶
type DataBuffer struct { MaxElementSize int Expired time.Duration GcInterval time.Duration // contains filtered or unexported fields }
DataBuffer is cacher for data
func NewDataBuffer ¶
func NewDataBuffer(maxElementSize int) *DataBuffer
NewDataBuffer create a DataBuffer
func (*DataBuffer) ClearDatas ¶
func (m *DataBuffer) ClearDatas(method string)
ClearDatas clears all method-url mapping on table tableName from cache
func (*DataBuffer) DelData ¶
func (m *DataBuffer) DelData(method string, url string)
DelData deletes data
func (*DataBuffer) GC ¶
func (m *DataBuffer) GC()
GC check ids lit and sql list to remove all element expired
func (*DataBuffer) GetData ¶
func (m *DataBuffer) GetData(method string, url string) interface{}
GetData returns data according method and url from cache
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore represents in-memory store
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new store in memory
func (*MemoryStore) Get ¶
func (s *MemoryStore) Get(key string) (interface{}, error)
Get gets object from store
func (*MemoryStore) Put ¶
func (s *MemoryStore) Put(key string, value interface{}) error
Put puts object into store
Click to show internal directories.
Click to hide internal directories.