Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Put a new value to cache
Put(key string, value interface{}, ttl time.Duration) bool
// PutForever put value with infinite ttl
PutForever(key string, value interface{}) bool
// Set Change value of cache item
Set(key string, value interface{}) bool
// Get item from cache
Get(key string) interface{}
// Pull item from cache and remove it
Pull(key string) interface{}
// Check if item exists in cache
Exists(key string) bool
// Forget item from cache (delete item)
Forget(key string) bool
// TTL get cache item ttl
TTL(key string) time.Duration
// Bool parse dependency as boolean
Bool(key string, fallback bool) bool
// Int parse dependency as int
Int(key string, fallback int) int
// Int8 parse dependency as int8
Int8(key string, fallback int8) int8
// Int16 parse dependency as int16
Int16(key string, fallback int16) int16
// Int32 parse dependency as int32
Int32(key string, fallback int32) int32
// Int64 parse dependency as int64
Int64(key string, fallback int64) int64
// UInt parse dependency as uint
UInt(key string, fallback uint) uint
// UInt8 parse dependency as uint8
UInt8(key string, fallback uint8) uint8
// UInt16 parse dependency as uint16
UInt16(key string, fallback uint16) uint16
// UInt32 parse dependency as uint32
UInt32(key string, fallback uint32) uint32
// UInt64 parse dependency as uint64
UInt64(key string, fallback uint64) uint64
// Float32 parse dependency as float64
Float32(key string, fallback float32) float32
// Float64 parse dependency as float64
Float64(key string, fallback float64) float64
// String parse dependency as string
String(key string, fallback string) string
// Bytes parse dependency as bytes array
Bytes(key string, fallback []byte) []byte
// Increment numeric item in cache
Increment(key string) bool
// IncrementBy numeric item in cache by number
IncrementBy(key string, value interface{}) bool
// Decrement numeric item in cache
Decrement(key string) bool
// DecrementBy numeric item in cache by number
DecrementBy(key string, value interface{}) bool
}
Cache interface for cache drivers.
func NewFileCache ¶
NewFileCache create a new file cache manager instance
type RateLimiter ¶
type RateLimiter interface {
// Hit decrease the allowed times
Hit()
// Lock lock rate limiter
Lock()
// Reset reset rate limiter
Reset()
// MustLock check if rate limiter must lock access
MustLock() bool
// TotalAttempts get user attempts count
TotalAttempts() uint32
// RetriesLeft get user retries left
RetriesLeft() uint32
// AvailableIn get time until unlock
AvailableIn() time.Duration
}
RateLimiter interface for rate limiter
func NewRateLimiter ¶
NewRateLimiter create a new rate limiter
type VerificationCode ¶
type VerificationCode interface {
// Set set code
Set(value string)
// Generate generate a random numeric code with 5 character length
Generate() (string, error)
// GenerateN generate a random numeric code with special character length
GenerateN(count uint) (string, error)
// Clear clear code
Clear()
// Get get code
Get() string
// Exists check if code exists
Exists() bool
}
VerificationCode interface for verification code
func NewVerificationCode ¶
func NewVerificationCode(key string, ttl time.Duration, cache Cache) VerificationCode
NewVerificationCode create a new verification code manager instance
Click to show internal directories.
Click to hide internal directories.