Documentation ¶
Index ¶
- type FlowCountService
- type FlowCounter
- type RedisFlowCountService
- func (o *RedisFlowCountService) GetDayData(t time.Time, loc *time.Location) (int64, error)
- func (o *RedisFlowCountService) GetDayKey(t time.Time, loc *time.Location) string
- func (o *RedisFlowCountService) GetHourData(t time.Time, loc *time.Location) (int64, error)
- func (o *RedisFlowCountService) GetHourKey(t time.Time, loc *time.Location) string
- func (o *RedisFlowCountService) Increase()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlowCountService ¶
type FlowCountService struct { AppID string //应用ID Interval time.Duration //采集频率 TotalCount int64 //当前总共请求数 QPS int64 //QPS Unix int64 //上次unix时间戳 TickerCount int64 //当前流量 }
本地统计用的counter
func NewFlowCountService ¶
func NewFlowCountService(appID string, interval time.Duration) (*FlowCountService, error)
type FlowCounter ¶
type FlowCounter struct { RedisFlowCountMap map[string]*RedisFlowCountService RedisFlowCountSlice []*RedisFlowCountService Locker sync.RWMutex }
var FlowCounterHandler *FlowCounter
func NewFlowCounter ¶
func NewFlowCounter() *FlowCounter
func (*FlowCounter) GetCounter ¶
func (counter *FlowCounter) GetCounter(serverName string) (*RedisFlowCountService, error)
type RedisFlowCountService ¶
type RedisFlowCountService struct { AppID string Interval time.Duration QPS int64 Unix int64 TickerCount int64 TotalCount int64 }
func (*RedisFlowCountService) GetDayData ¶
func (*RedisFlowCountService) GetHourData ¶
func (*RedisFlowCountService) GetHourKey ¶
Click to show internal directories.
Click to hide internal directories.