Documentation ¶
Index ¶
- Constants
- Variables
- func Chk(err error)
- func Contains(s []string, e string) bool
- func ContainsInf(s []interface{}, e interface{}) bool
- func ContainsObjectId(s []bson.ObjectId, e string) bool
- func CreateRedisPool(size int, server, auth string) *redis.Pool
- func DeleteMap(m map[string]interface{}, ks ...string)
- func Env(name string, required bool, showLog ...bool) string
- func Fint(s interface{}, dft ...int64) int
- func Fint64(s interface{}, dft ...int64) int64
- func Http2Get(getUrl string, credential ...string) ([]byte, error)
- func Http2Post(postUrl string, q url.Values, credential ...string) ([]byte, error)
- func HttpGet(getUrl string, credential ...string) ([]byte, error)
- func HttpPost(postUrl string, q url.Values, credential ...string) ([]byte, error)
- func IsPemExpire(b []byte) (bool, error)
- func Md5(b []byte) []byte
- func Md5Str(salt string) func(string) string
- func MidConcurrent(concurrent ...int) func(http.ResponseWriter, martini.Context)
- func MidSlowLog(limit int) func(*http.Request, martini.Context)
- func MidTextDefault(w http.ResponseWriter)
- func MidWeb(w http.ResponseWriter, c martini.Context)
- func MongoConnect(db string) *mgo.Session
- func MongoNotFound(err error) bool
- func NotFound(err error) bool
- func ParseUrl(s string) (string, int, error)
- func SendMail(user, password, host, to, subject, body, mailtype string) error
- func Shuffle(src []string) []string
- func SplitSlice(a []string, n int) [][]string
- func Tick(t ...time.Time) int64
- func TickHour() int64
- func TickSec() int64
- func ToTimeMillis(fmt string, timeStr string) (int64, error)
- func Truncate(s string, n int) string
- func Unique(data []interface{}) []interface{}
- func UniqueStr(data []string) []string
- type J
- type MemQueue
- type SimpleRedisQueue
- func (p *SimpleRedisQueue) BufferCap() int
- func (p *SimpleRedisQueue) BufferLen() int
- func (p *SimpleRedisQueue) Deq() (interface{}, error)
- func (p *SimpleRedisQueue) Enq(data interface{}) error
- func (p *SimpleRedisQueue) EnqBlocking(data interface{})
- func (p *SimpleRedisQueue) Len() (int, error)
- func (p *SimpleRedisQueue) PollSize() int
- type SyncMap
- type Throttle
- type TimeMatrix
- type TimerCache
- type Web
Constants ¶
View Source
const (
MAX_HTTP_CLIENT_CONCURRENT = 1000
)
Variables ¶
View Source
var ErrFull = errors.New("queue is full")
View Source
var (
HttpClientThrottle = make(chan interface{}, MAX_HTTP_CLIENT_CONCURRENT)
)
View Source
var ( //passwd md5 PlainMd5 = Md5Str("") )
Functions ¶
func ContainsInf ¶
func ContainsInf(s []interface{}, e interface{}) bool
func IsPemExpire ¶
func MidConcurrent ¶
func MidConcurrent(concurrent ...int) func(http.ResponseWriter, martini.Context)
func MidTextDefault ¶
func MidTextDefault(w http.ResponseWriter)
func MongoConnect ¶
func MongoConnect(db string) *mgo.Session
func MongoNotFound ¶
func SplitSlice ¶
split a into several parts, no more than n
Types ¶
type MemQueue ¶
type MemQueue chan interface{}
func NewLeakMemQueue ¶
create memory queue, auto-leak element concurrently to worker
func NewMemQueue ¶
func (MemQueue) EnqBlocking ¶
func (p MemQueue) EnqBlocking(data interface{})
enqueue, block if queue is full
type SimpleRedisQueue ¶
type SimpleRedisQueue struct {
// contains filtered or unexported fields
}
func NewSimpleRedisQueue ¶
func NewSimpleRedisQueue(server, auth, name string, concurrent, enqBatch, buffer int) *SimpleRedisQueue
redis queue with optional memory buffer server: redis server address auth: redis auth name: queue name in redis concurrent: concurrent number redis enqueue operation, must >=1 enqBatch: batch enqueue number, must >=1 buffer: memory buffer capacity, must >= 0
func (*SimpleRedisQueue) BufferCap ¶
func (p *SimpleRedisQueue) BufferCap() int
func (*SimpleRedisQueue) BufferLen ¶
func (p *SimpleRedisQueue) BufferLen() int
func (*SimpleRedisQueue) Deq ¶
func (p *SimpleRedisQueue) Deq() (interface{}, error)
func (*SimpleRedisQueue) Enq ¶
func (p *SimpleRedisQueue) Enq(data interface{}) error
enqueue, return error if buffer is full
func (*SimpleRedisQueue) EnqBlocking ¶
func (p *SimpleRedisQueue) EnqBlocking(data interface{})
enqueue, block if buffer is full
func (*SimpleRedisQueue) Len ¶
func (p *SimpleRedisQueue) Len() (int, error)
func (*SimpleRedisQueue) PollSize ¶
func (p *SimpleRedisQueue) PollSize() int
type Throttle ¶
type Throttle struct {
// contains filtered or unexported fields
}
func NewThrottle ¶
type TimeMatrix ¶
func (*TimeMatrix) Print ¶
func (p *TimeMatrix) Print()
func (*TimeMatrix) Rec ¶
func (p *TimeMatrix) Rec(name string)
type TimerCache ¶
func NewTimerCache ¶
func NewTimerCache(ttl int, expireCb func(key, value interface{})) *TimerCache
ttl in second expireCb, expire callback
func (*TimerCache) Get ¶
func (p *TimerCache) Get(key interface{}) interface{}
func (*TimerCache) Keys ¶
func (p *TimerCache) Keys() []interface{}
func (*TimerCache) Len ¶
func (p *TimerCache) Len() int
func (*TimerCache) Put ¶
func (p *TimerCache) Put(key, val interface{}) bool
func (*TimerCache) Remove ¶
func (p *TimerCache) Remove(key interface{}) interface{}
Click to show internal directories.
Click to hide internal directories.