Documentation ¶
Index ¶
- type Logger
- type Store
- func NewMemoryStore(gcInterval, expiration time.Duration) Store
- func NewRedisClusterStore(opts *redis.ClusterOptions, expiration time.Duration, out Logger, ...) Store
- func NewRedisClusterStoreWithCli(cli *redis.ClusterClient, expiration time.Duration, out Logger, ...) Store
- func NewRedisStore(opts *redis.Options, expiration time.Duration, out Logger, prefix ...string) Store
- func NewRedisStoreWithCli(cli *redis.Client, expiration time.Duration, out Logger, prefix ...string) Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Printf(format string, args ...interface{})
}
Logger Define the log output interface
type Store ¶
type Store interface { // Set sets the digits for the captcha id. Set(id string, digits []byte) // Get returns stored digits for the captcha id. Clear indicates // whether the captcha must be deleted from the store. Get(id string, clear bool) (digits []byte) }
Store An object implementing Store interface can be registered with SetCustomStore function to handle storage and retrieval of captcha ids and solutions for them, replacing the default memory store.
It is the responsibility of an object to delete expired and used captchas when necessary (for example, the default memory store collects them in Set method after the certain amount of captchas has been stored.)
func NewMemoryStore ¶
NewMemoryStore An internal store for captcha ids and their values.
func NewRedisClusterStore ¶
func NewRedisClusterStore(opts *redis.ClusterOptions, expiration time.Duration, out Logger, prefix ...string) Store
NewRedisClusterStore create an instance of a redis cluster store
func NewRedisClusterStoreWithCli ¶
func NewRedisClusterStoreWithCli(cli *redis.ClusterClient, expiration time.Duration, out Logger, prefix ...string) Store
NewRedisClusterStoreWithCli create an instance of a redis cluster store