Documentation
¶
Index ¶
- Constants
- Variables
- func Char2Int(code string, base uint64) (uint64, error)
- func GenAutoId(client *redisc.RedisCli) uint64
- func GenAutoIdByClu(client *redisc.RedisClusterCli) uint64
- func GenAutoIdByKey(client *redisc.RedisCli, counterGroupKey string) uint64
- func GenAutoIdByKeyClu(client *redisc.RedisClusterCli, counterGroupKey string) uint64
- func GenAutoIds(n uint64, client *redisc.RedisCli) []uint64
- func GenAutoIdsByClu(n uint64, client *redisc.RedisClusterCli) []uint64
- func GenAutoIdsByKey(n uint64, client *redisc.RedisCli, counterGroupKey string) []uint64
- func GenAutoIdsByKeyClu(n uint64, client *redisc.RedisClusterCli, counterGroupKey string) []uint64
- func Int2Char(number, base uint64) (string, error)
- func IsAllowedByMap(userId, actionKey string, capacity int64, leakingRate float64) bool
- func IsAllowedByRedis(userId, actionKey string, capacity int64, leakingRate float64, ...) bool
- func IsAllowedByRedisCluster(userId, actionKey string, capacity int64, leakingRate float64, ...) bool
- func IsLimitedByMap(userId, actionKey string, capacity int, leakingRate float64) bool
- func IsLimitedByRedis(userId, actionKey string, capacity int, leakingRate float64, ...) bool
- func IsLimitedByRedisCluster(userId, actionKey string, capacity int, leakingRate float64, ...) bool
- type ShortUrl
Constants ¶
View Source
const ( MAX_RANDOM_NUMBER = 256 SALT_ONE_LENGTH = 8 SALT_TWO_LENGTH = 8 SALT_ONE_SHIFT = SALT_TWO_LENGTH INCREASE_COUNTER_SHIFT = SALT_TWO_LENGTH + SALT_ONE_LENGTH AUTO_ID_GENERATOR_COUNTER_KEY = "auto_id_generator_counter_key" )
Variables ¶
View Source
var ( SHORT_URL_INFO_INDEX = "short_url_info_index" SHORT_URL_INFO_INDEX_DOC_TYPE = "short_url_info_index_doc_type" BASE_STR = "RScdTU567rstu89ABCDijnopEFGefwxHIJ01klm2ghqv34KLMNOPQVWXYZabyz" BASE_CHAR = []string{"R", "S", "c", "d", "T", "U", "5", "6", "7", "r", "s", "t", "u", "8", "9", "A", "B", "C", "D", "i", "j", "n", "o", "p", "E", "F", "G", "e", "f", "w", "x", "H", "I", "J", "0", "1", "k", "l", "m", "2", "g", "h", "q", "v", "3", "4", "K", "L", "M", "N", "O", "P", "Q", "V", "W", "X", "Y", "Z", "a", "b", "y", "z"} )
Functions ¶
func GenAutoIdByClu ¶ added in v0.2.3
func GenAutoIdByClu(client *redisc.RedisClusterCli) uint64
func GenAutoIdByKey ¶ added in v0.2.4
func GenAutoIdByKeyClu ¶ added in v0.2.4
func GenAutoIdByKeyClu(client *redisc.RedisClusterCli, counterGroupKey string) uint64
func GenAutoIdsByClu ¶ added in v0.2.3
func GenAutoIdsByClu(n uint64, client *redisc.RedisClusterCli) []uint64
func GenAutoIdsByKey ¶ added in v0.2.4
func GenAutoIdsByKeyClu ¶ added in v0.2.4
func GenAutoIdsByKeyClu(n uint64, client *redisc.RedisClusterCli, counterGroupKey string) []uint64
func IsAllowedByMap ¶
func IsAllowedByRedis ¶
func IsAllowedByRedisCluster ¶
func IsLimitedByMap ¶
func IsLimitedByRedis ¶
func IsLimitedByRedisCluster ¶
Types ¶
type ShortUrl ¶ added in v0.2.3
type ShortUrl struct {
BaseUrl string // The url or domain name of the server, e.g. http://127.0.0.1:8080/api/d/
Rediscli *redisc.RedisCli // redis Standalone Client or Cluster Either one can be initialized
Redisclu *redisc.RedisClusterCli // redis Standalone Client or Cluster Either one can be initialized
Esc7 *esc.EsClient7 // Just choose any one of the different versions of ES to initialize
Esc8 *esc.EsClient8 // Just choose any one of the different versions of ES to initialize
}
func (*ShortUrl) ConvLongUrl ¶ added in v0.2.3
Click to show internal directories.
Click to hide internal directories.