core

package
v0.0.0-...-2e696e2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HideReaddirFS

type HideReaddirFS struct {
	FileSystem http.FileSystem
}

FileSystem with hide Readdir

func (HideReaddirFS) Open

func (fs HideReaddirFS) Open(name string) (http.File, error)

Conforms to http.Filesystem

type ItemContext

type ItemContext struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

自带锁,并发安全的Map

func NewItemContext

func NewItemContext() *ItemContext

func (*ItemContext) Exists

func (ctx *ItemContext) Exists(key string) bool

check exists key

func (*ItemContext) Get

func (ctx *ItemContext) Get(key string) (value interface{}, exists bool)

* 读取指定key在AppContext中的内容

func (*ItemContext) GetCurrentMap

func (ctx *ItemContext) GetCurrentMap() map[string]interface{}

get current map, returns map[string]interface{}

func (*ItemContext) GetInt

func (ctx *ItemContext) GetInt(key string) int

* 读取指定key在AppContext中的内容,以int格式输出

func (*ItemContext) GetString

func (ctx *ItemContext) GetString(key string) string

* 读取指定key在AppContext中的内容,以string格式输出

func (*ItemContext) Len

func (ctx *ItemContext) Len() int

get context length

func (*ItemContext) Once

func (ctx *ItemContext) Once(key string) (value interface{}, exists bool)

get item by gived key, and remove it only can be read once, it will be locked

func (*ItemContext) Remove

func (ctx *ItemContext) Remove(key string)

remove item by gived key if not exists key, do nothing...

func (*ItemContext) Set

func (ctx *ItemContext) Set(key string, value interface{}) error

* 以key、value置入AppContext

type ServerStateInfo

type ServerStateInfo struct {
	//服务启动时间
	ServerStartTime time.Time
	//该运行期间总访问次数
	TotalRequestCount uint64
	//该运行期间错误次数
	TotalErrorCount uint64
}

服务器状态信息

var GlobalState *ServerStateInfo

func (*ServerStateInfo) AddErrorCount

func (state *ServerStateInfo) AddErrorCount(num uint64) uint64

增加错误数

func (*ServerStateInfo) AddRequestCount

func (state *ServerStateInfo) AddRequestCount(num uint64) uint64

增加请求数

Jump to

Keyboard shortcuts

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