store

package
Version: v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2017 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// mem:  front = = = back
	// time: latest ...  old
	HistoryCache = tmap.NewSafeMap()
)

Functions

func AddItem

func AddItem(key string, val *cmodel.GraphItem)

func GetAllItems

func GetAllItems(key string) []*cmodel.GraphItem

func GetLastItem

func GetLastItem(key string) *cmodel.GraphItem

Types

type GraphItemMap

type GraphItemMap struct {
	sync.RWMutex
	A    []map[string]*SafeLinkedList
	Size int
}
var GraphItems *GraphItemMap

func (*GraphItemMap) Back

func (this *GraphItemMap) Back(key string) *cmodel.GraphItem

func (*GraphItemMap) FetchAll

func (this *GraphItemMap) FetchAll(key string) ([]*cmodel.GraphItem, uint32)

func (*GraphItemMap) First

func (this *GraphItemMap) First(key string) *cmodel.GraphItem

func (*GraphItemMap) Get

func (this *GraphItemMap) Get(key string) (*SafeLinkedList, bool)

func (*GraphItemMap) GetFlag

func (this *GraphItemMap) GetFlag(key string) (uint32, error)

func (*GraphItemMap) Getitems

func (this *GraphItemMap) Getitems(idx int) map[string]*SafeLinkedList

func (*GraphItemMap) ItemCnt

func (this *GraphItemMap) ItemCnt(key string) int

指定key对应的Item数量

func (*GraphItemMap) KeysByIndex

func (this *GraphItemMap) KeysByIndex(idx int) []string

func (*GraphItemMap) Len

func (this *GraphItemMap) Len() int

func (*GraphItemMap) PopAll

func (this *GraphItemMap) PopAll(key string) []*cmodel.GraphItem

func (*GraphItemMap) PushAll

func (this *GraphItemMap) PushAll(key string, items []*cmodel.GraphItem) error

func (*GraphItemMap) PushFront

func (this *GraphItemMap) PushFront(key string,
	item *cmodel.GraphItem, md5 string, cfg *g.GlobalConfig)

func (*GraphItemMap) Remove

func (this *GraphItemMap) Remove(key string) bool

Remove method remove key from GraphItemMap, return true if exists

func (*GraphItemMap) Set

func (this *GraphItemMap) Set(key string, val *SafeLinkedList)

func (*GraphItemMap) SetFlag

func (this *GraphItemMap) SetFlag(key string, flag uint32) error

type SafeLinkedList

type SafeLinkedList struct {
	sync.RWMutex
	Flag uint32
	L    *list.List
}

func NewSafeLinkedList

func NewSafeLinkedList() *SafeLinkedList

新创建SafeLinkedList容器

func (*SafeLinkedList) Back

func (this *SafeLinkedList) Back() *list.Element

func (*SafeLinkedList) FetchAll

func (this *SafeLinkedList) FetchAll() ([]*cmodel.GraphItem, uint32)

return为倒叙的?

func (*SafeLinkedList) Front

func (this *SafeLinkedList) Front() *list.Element

func (*SafeLinkedList) Len

func (this *SafeLinkedList) Len() int

func (*SafeLinkedList) PopAll

func (this *SafeLinkedList) PopAll() []*cmodel.GraphItem

remain参数表示要给linkedlist中留几个元素 在cron中刷磁盘的时候要留一个,用于创建数据库索引 在程序退出的时候要一个不留的全部刷到磁盘

func (*SafeLinkedList) PopBack

func (this *SafeLinkedList) PopBack() *list.Element

func (*SafeLinkedList) PushAll

func (this *SafeLinkedList) PushAll(items []*cmodel.GraphItem)

restore PushAll

func (*SafeLinkedList) PushFront

func (this *SafeLinkedList) PushFront(v interface{}) *list.Element

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL