Documentation ¶
Index ¶
- Constants
- func CalculateMovingAverage(key string) (int, error)
- func CalculateMovingAverageAndSumMaybePop(key string, limit int, shouldPopIfExcess bool) (average int, sum int, err error)
- func CalculateMovingAverageRat(key string) (*big.Rat, error)
- func StoreAndCalculate(key string, x int) (int, error)
- func StoreAndCalculateRat(key string, x *big.Rat) (*big.Rat, error)
- func StoreValue(key string, x interface{})
Constants ¶
View Source
const DefaultBufferSize = 500
DefaultBufferSize to use when storing the ring buffer
Variables ¶
This section is empty.
Functions ¶
func CalculateMovingAverage ¶
CalculateMovingAverage by taking the key given and calculating the current moving average by scanning the current list
func CalculateMovingAverageAndSumMaybePop ¶
func CalculateMovingAverageAndSumMaybePop(key string, limit int, shouldPopIfExcess bool) (average int, sum int, err error)
CalculateMovingAverageAndSumMaybePop with the limit given, by getting a range over each item then popping anything that exceeds the limit if the flag is set
func StoreAndCalculate ¶
StoreAndCalculate the moving average by storing the amount then doing the calculation
func StoreValue ¶
func StoreValue(key string, x interface{})
StoreValue by storing the value as-is in redis
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.