persec

package
v0.0.0-...-a4fc4a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOptimisticAvgRequests

func GetOptimisticAvgRequests(totalRequests int, totalRequestsDuration time.Duration, desiredDuration time.Duration) int64

GetOptimisticAvgRequests Returns avg requests for the given duration optimistically

func GetRealAvgRequests

func GetRealAvgRequests(totalRequests int, desiredDuration time.Duration) int64

GetRealAvgRequests Returns avg requests for the given duration realistically

func GetRedisConn

func GetRedisConn(redisURL string) (redis.Conn, error)

GetRedisConn Returns the connection to Redis

func GetRequestKeyTimestamp

func GetRequestKeyTimestamp(requestKey string, timestamp time.Time) string

GetRequestKeyTimestamp Get the complete RequestKey

func GetTotalRequests

func GetTotalRequests(
	conn redis.Conn,
	requestKeyWithoutTimestamp string,
	timestampStart int64,
	timestampEnd int64) (int, time.Duration, error)

GetTotalRequests Returns the total requests for the give period

func IncrementRequestKey

func IncrementRequestKey(conn redis.Conn, requestKeyTimestamp string) (int, error)

IncrementRequestKey Inscrements the amount of times a certain key was requested

Types

type AddRequestResponse

type AddRequestResponse struct {
	// contains filtered or unexported fields
}

AddRequestResponse Add response struct

type GetRequestResponse

type GetRequestResponse struct {
	// contains filtered or unexported fields
}

GetRequestResponse Get response struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL