Documentation
¶
Index ¶
- func RedisConfDo(commandName string, args ...interface{}) (interface{}, error)
- func RedisConfPipline(pip ...func(c redis.Conn)) error
- type FlowCounter
- type RedisFlowCountService
- func (o *RedisFlowCountService) GetDayData(t time.Time) (int64, error)
- func (o *RedisFlowCountService) GetDayKey(t time.Time) string
- func (o *RedisFlowCountService) GetHourData(t time.Time) (int64, error)
- func (o *RedisFlowCountService) GetHourKey(t time.Time) string
- func (o *RedisFlowCountService) Increase()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedisConfDo ¶
func RedisConfPipline ¶
Types ¶
type FlowCounter ¶
type FlowCounter struct { // 当服务多的时候使用map方便,但是需要加锁 RedisFlowCountMap map[string]*RedisFlowCountService // 当服务比较少的时候使用 slice 便利,减少锁的开销 RedisFlowCountSlice []*RedisFlowCountService Locker sync.RWMutex }
var FlowCounterHandler *FlowCounter
func NewFlowCounter ¶
func NewFlowCounter() *FlowCounter
func (*FlowCounter) GetCounter ¶
func (counter *FlowCounter) GetCounter(serviceName string) (*RedisFlowCountService, error)
type RedisFlowCountService ¶
type RedisFlowCountService struct { AppID string Interval time.Duration QPS int64 Unix int64 TickerCount int64 TotalCount int64 }
func NewRedisFlowCountService ¶
func NewRedisFlowCountService(appID string, interval time.Duration) *RedisFlowCountService
func (*RedisFlowCountService) GetDayData ¶
func (o *RedisFlowCountService) GetDayData(t time.Time) (int64, error)
func (*RedisFlowCountService) GetDayKey ¶
func (o *RedisFlowCountService) GetDayKey(t time.Time) string
func (*RedisFlowCountService) GetHourData ¶
func (o *RedisFlowCountService) GetHourData(t time.Time) (int64, error)
func (*RedisFlowCountService) GetHourKey ¶
func (o *RedisFlowCountService) GetHourKey(t time.Time) string
Click to show internal directories.
Click to hide internal directories.