store

package
v0.0.0-...-0b911c8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT, MIT Imports: 5 Imported by: 0

Documentation

Index

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

func NewMemoryStore(gcInterval, expiration time.Duration) Store

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

func NewRedisStore

func NewRedisStore(opts *redis.Options, expiration time.Duration, out Logger, prefix ...string) Store

NewRedisStore create an instance of a redis store

func NewRedisStoreWithCli

func NewRedisStoreWithCli(cli *redis.Client, expiration time.Duration, out Logger, prefix ...string) Store

NewRedisStoreWithCli create an instance of a redis store

Jump to

Keyboard shortcuts

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