|
@@ -16,17 +16,18 @@ import (
|
|
|
const (
|
|
const (
|
|
|
// Standard number of digits in captcha.
|
|
// Standard number of digits in captcha.
|
|
|
StdLength = 6
|
|
StdLength = 6
|
|
|
- // The number of captchas created that triggers garbage collection.
|
|
|
|
|
- StdCollectNum = 100
|
|
|
|
|
- // Expiration time of captchas.
|
|
|
|
|
- StdExpiration = 10 * 60 // 10 minutes
|
|
|
|
|
|
|
+ // The number of captchas created that triggers garbage collection used
|
|
|
|
|
+ // by default store.
|
|
|
|
|
+ CollectNum = 100
|
|
|
|
|
+ // Expiration time of captchas used by default store.
|
|
|
|
|
+ Expiration = 10 * 60 // 10 minutes
|
|
|
|
|
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
var ErrNotFound = os.NewError("captcha with the given id not found")
|
|
var ErrNotFound = os.NewError("captcha with the given id not found")
|
|
|
|
|
|
|
|
// globalStore is a shared storage for captchas, generated by New function.
|
|
// globalStore is a shared storage for captchas, generated by New function.
|
|
|
-var globalStore = NewMemoryStore(StdCollectNum, StdExpiration)
|
|
|
|
|
|
|
+var globalStore = NewMemoryStore(CollectNum, Expiration)
|
|
|
|
|
|
|
|
// SetCustomStore sets custom storage for captchas.
|
|
// SetCustomStore sets custom storage for captchas.
|
|
|
func SetCustomStore(s Store) {
|
|
func SetCustomStore(s Store) {
|