示例#1
0
// Generate a request id for each request.
func requestId() martini.Handler {
	// requestIdFunc return a httphelper.RequestId type of value.
	requestIdFunc := httphelper.RequestIdGenerator(32)

	return func(c martini.Context) {
		c.Map(requestIdFunc())
		c.Next()
	}
}
示例#2
0
文件: vars.go 项目: royalwang/ran
package server

import "github.com/oxtoacart/bpool"
import hhelper "github.com/m3ng9i/go-utils/http"

// TODO set number of buffer in config
// global buffer pool for ran server
var bufferPool = bpool.NewBufferPool(200)

// a function to generate a 12 characters random request id.
var getRequestId = hhelper.RequestIdGenerator(12)