Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
5befc673
Commit
5befc673
authored
Jan 13, 2016
by
JessonChan
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/upstream/develop' into log_enhancement
parents
fb5b0450
6660720c
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
71 additions
and
68 deletions
+71
-68
admin.go
admin.go
+3
-3
app.go
app.go
+4
-4
README.md
cache/README.md
+1
-1
cache.go
cache/cache.go
+4
-3
cache_test.go
cache/cache_test.go
+9
-7
file.go
cache/file.go
+9
-9
memcache.go
cache/memcache/memcache.go
+3
-2
memcache_test.go
cache/memcache/memcache_test.go
+5
-4
memory.go
cache/memory.go
+4
-8
redis.go
cache/redis/redis.go
+2
-2
redis_test.go
cache/redis/redis_test.go
+5
-4
config.go
config.go
+15
-15
hooks.go
hooks.go
+2
-2
router.go
router.go
+2
-2
captcha.go
utils/captcha/captcha.go
+3
-2
No files found.
admin.go
View file @
5befc673
...
@@ -104,15 +104,15 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
...
@@ -104,15 +104,15 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
m
[
"BConfig.Listen.Graceful"
]
=
BConfig
.
Listen
.
Graceful
m
[
"BConfig.Listen.Graceful"
]
=
BConfig
.
Listen
.
Graceful
m
[
"BConfig.Listen.ServerTimeOut"
]
=
BConfig
.
Listen
.
ServerTimeOut
m
[
"BConfig.Listen.ServerTimeOut"
]
=
BConfig
.
Listen
.
ServerTimeOut
m
[
"BConfig.Listen.ListenTCP4"
]
=
BConfig
.
Listen
.
ListenTCP4
m
[
"BConfig.Listen.ListenTCP4"
]
=
BConfig
.
Listen
.
ListenTCP4
m
[
"BConfig.Listen.
HTTPEnable"
]
=
BConfig
.
Listen
.
HTTPEnable
m
[
"BConfig.Listen.
EnableHTTP"
]
=
BConfig
.
Listen
.
EnableHTTP
m
[
"BConfig.Listen.HTTPAddr"
]
=
BConfig
.
Listen
.
HTTPAddr
m
[
"BConfig.Listen.HTTPAddr"
]
=
BConfig
.
Listen
.
HTTPAddr
m
[
"BConfig.Listen.HTTPPort"
]
=
BConfig
.
Listen
.
HTTPPort
m
[
"BConfig.Listen.HTTPPort"
]
=
BConfig
.
Listen
.
HTTPPort
m
[
"BConfig.Listen.
HTTPSEnable"
]
=
BConfig
.
Listen
.
HTTPSEnable
m
[
"BConfig.Listen.
EnableHTTPS"
]
=
BConfig
.
Listen
.
EnableHTTPS
m
[
"BConfig.Listen.HTTPSAddr"
]
=
BConfig
.
Listen
.
HTTPSAddr
m
[
"BConfig.Listen.HTTPSAddr"
]
=
BConfig
.
Listen
.
HTTPSAddr
m
[
"BConfig.Listen.HTTPSPort"
]
=
BConfig
.
Listen
.
HTTPSPort
m
[
"BConfig.Listen.HTTPSPort"
]
=
BConfig
.
Listen
.
HTTPSPort
m
[
"BConfig.Listen.HTTPSCertFile"
]
=
BConfig
.
Listen
.
HTTPSCertFile
m
[
"BConfig.Listen.HTTPSCertFile"
]
=
BConfig
.
Listen
.
HTTPSCertFile
m
[
"BConfig.Listen.HTTPSKeyFile"
]
=
BConfig
.
Listen
.
HTTPSKeyFile
m
[
"BConfig.Listen.HTTPSKeyFile"
]
=
BConfig
.
Listen
.
HTTPSKeyFile
m
[
"BConfig.Listen.
AdminEnable"
]
=
BConfig
.
Listen
.
AdminEnable
m
[
"BConfig.Listen.
EnableAdmin"
]
=
BConfig
.
Listen
.
EnableAdmin
m
[
"BConfig.Listen.AdminAddr"
]
=
BConfig
.
Listen
.
AdminAddr
m
[
"BConfig.Listen.AdminAddr"
]
=
BConfig
.
Listen
.
AdminAddr
m
[
"BConfig.Listen.AdminPort"
]
=
BConfig
.
Listen
.
AdminPort
m
[
"BConfig.Listen.AdminPort"
]
=
BConfig
.
Listen
.
AdminPort
m
[
"BConfig.Listen.EnableFcgi"
]
=
BConfig
.
Listen
.
EnableFcgi
m
[
"BConfig.Listen.EnableFcgi"
]
=
BConfig
.
Listen
.
EnableFcgi
...
...
app.go
View file @
5befc673
...
@@ -100,7 +100,7 @@ func (app *App) Run() {
...
@@ -100,7 +100,7 @@ func (app *App) Run() {
if
BConfig
.
Listen
.
Graceful
{
if
BConfig
.
Listen
.
Graceful
{
httpsAddr
:=
BConfig
.
Listen
.
HTTPSAddr
httpsAddr
:=
BConfig
.
Listen
.
HTTPSAddr
app
.
Server
.
Addr
=
httpsAddr
app
.
Server
.
Addr
=
httpsAddr
if
BConfig
.
Listen
.
HTTPSEnable
{
if
BConfig
.
Listen
.
EnableHTTPS
{
go
func
()
{
go
func
()
{
time
.
Sleep
(
20
*
time
.
Microsecond
)
time
.
Sleep
(
20
*
time
.
Microsecond
)
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
...
@@ -117,7 +117,7 @@ func (app *App) Run() {
...
@@ -117,7 +117,7 @@ func (app *App) Run() {
}
}
}()
}()
}
}
if
BConfig
.
Listen
.
HTTPEnable
{
if
BConfig
.
Listen
.
EnableHTTP
{
go
func
()
{
go
func
()
{
server
:=
grace
.
NewServer
(
addr
,
app
.
Handlers
)
server
:=
grace
.
NewServer
(
addr
,
app
.
Handlers
)
server
.
Server
.
ReadTimeout
=
app
.
Server
.
ReadTimeout
server
.
Server
.
ReadTimeout
=
app
.
Server
.
ReadTimeout
...
@@ -138,7 +138,7 @@ func (app *App) Run() {
...
@@ -138,7 +138,7 @@ func (app *App) Run() {
// run normal mode
// run normal mode
app
.
Server
.
Addr
=
addr
app
.
Server
.
Addr
=
addr
if
BConfig
.
Listen
.
HTTPSEnable
{
if
BConfig
.
Listen
.
EnableHTTPS
{
go
func
()
{
go
func
()
{
time
.
Sleep
(
20
*
time
.
Microsecond
)
time
.
Sleep
(
20
*
time
.
Microsecond
)
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
...
@@ -152,7 +152,7 @@ func (app *App) Run() {
...
@@ -152,7 +152,7 @@ func (app *App) Run() {
}
}
}()
}()
}
}
if
BConfig
.
Listen
.
HTTPEnable
{
if
BConfig
.
Listen
.
EnableHTTP
{
go
func
()
{
go
func
()
{
app
.
Server
.
Addr
=
addr
app
.
Server
.
Addr
=
addr
BeeLogger
.
Info
(
"http server Running on %s"
,
app
.
Server
.
Addr
)
BeeLogger
.
Info
(
"http server Running on %s"
,
app
.
Server
.
Addr
)
...
...
cache/README.md
View file @
5befc673
...
@@ -26,7 +26,7 @@ Then init a Cache (example with memory adapter)
...
@@ -26,7 +26,7 @@ Then init a Cache (example with memory adapter)
Use it like this:
Use it like this:
bm.Put("astaxie", 1, 10)
bm.Put("astaxie", 1, 10
*
time.Second
)
bm.Get("astaxie")
bm.Get("astaxie")
bm.IsExist("astaxie")
bm.IsExist("astaxie")
bm.Delete("astaxie")
bm.Delete("astaxie")
...
...
cache/cache.go
View file @
5befc673
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
//
//
// Use it like this:
// Use it like this:
//
//
// bm.Put("astaxie", 1, 10)
// bm.Put("astaxie", 1, 10
* time.Second
)
// bm.Get("astaxie")
// bm.Get("astaxie")
// bm.IsExist("astaxie")
// bm.IsExist("astaxie")
// bm.Delete("astaxie")
// bm.Delete("astaxie")
...
@@ -33,13 +33,14 @@ package cache
...
@@ -33,13 +33,14 @@ package cache
import
(
import
(
"fmt"
"fmt"
"time"
)
)
// Cache interface contains all behaviors for cache adapter.
// Cache interface contains all behaviors for cache adapter.
// usage:
// usage:
// cache.Register("file",cache.NewFileCache) // this operation is run in init method of file.go.
// cache.Register("file",cache.NewFileCache) // this operation is run in init method of file.go.
// c,err := cache.NewCache("file","{....}")
// c,err := cache.NewCache("file","{....}")
// c.Put("key",value,
3600
)
// c.Put("key",value,
3600 * time.Second
)
// v := c.Get("key")
// v := c.Get("key")
//
//
// c.Incr("counter") // now is 1
// c.Incr("counter") // now is 1
...
@@ -51,7 +52,7 @@ type Cache interface {
...
@@ -51,7 +52,7 @@ type Cache interface {
// GetMulti is a batch version of Get.
// GetMulti is a batch version of Get.
GetMulti
(
keys
[]
string
)
[]
interface
{}
GetMulti
(
keys
[]
string
)
[]
interface
{}
// set cached value with key and expire time.
// set cached value with key and expire time.
Put
(
key
string
,
val
interface
{},
timeout
int64
)
error
Put
(
key
string
,
val
interface
{},
timeout
time
.
Duration
)
error
// delete cached value by key.
// delete cached value by key.
Delete
(
key
string
)
error
Delete
(
key
string
)
error
// increase cached int value by key, as a counter.
// increase cached int value by key, as a counter.
...
...
cache/cache_test.go
View file @
5befc673
...
@@ -25,7 +25,8 @@ func TestCache(t *testing.T) {
...
@@ -25,7 +25,8 @@ func TestCache(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"init err"
)
t
.
Error
(
"init err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
10
);
err
!=
nil
{
timeoutDuration
:=
10
*
time
.
Second
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -42,7 +43,7 @@ func TestCache(t *testing.T) {
...
@@ -42,7 +43,7 @@ func TestCache(t *testing.T) {
t
.
Error
(
"check err"
)
t
.
Error
(
"check err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
...
@@ -67,7 +68,7 @@ func TestCache(t *testing.T) {
...
@@ -67,7 +68,7 @@ func TestCache(t *testing.T) {
}
}
//test GetMulti
//test GetMulti
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -77,7 +78,7 @@ func TestCache(t *testing.T) {
...
@@ -77,7 +78,7 @@ func TestCache(t *testing.T) {
t
.
Error
(
"get err"
)
t
.
Error
(
"get err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie1"
)
{
if
!
bm
.
IsExist
(
"astaxie1"
)
{
...
@@ -101,7 +102,8 @@ func TestFileCache(t *testing.T) {
...
@@ -101,7 +102,8 @@ func TestFileCache(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"init err"
)
t
.
Error
(
"init err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
10
);
err
!=
nil
{
timeoutDuration
:=
10
*
time
.
Second
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -133,7 +135,7 @@ func TestFileCache(t *testing.T) {
...
@@ -133,7 +135,7 @@ func TestFileCache(t *testing.T) {
}
}
//test string
//test string
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -144,7 +146,7 @@ func TestFileCache(t *testing.T) {
...
@@ -144,7 +146,7 @@ func TestFileCache(t *testing.T) {
}
}
//test GetMulti
//test GetMulti
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie1"
)
{
if
!
bm
.
IsExist
(
"astaxie1"
)
{
...
...
cache/file.go
View file @
5befc673
...
@@ -33,8 +33,8 @@ import (
...
@@ -33,8 +33,8 @@ import (
// it contains data and expire time.
// it contains data and expire time.
type
FileCacheItem
struct
{
type
FileCacheItem
struct
{
Data
interface
{}
Data
interface
{}
Lastaccess
int64
Lastaccess
time
.
Time
Expired
int64
Expired
time
.
Time
}
}
// FileCache Config
// FileCache Config
...
@@ -42,7 +42,7 @@ var (
...
@@ -42,7 +42,7 @@ var (
FileCachePath
=
"cache"
// cache directory
FileCachePath
=
"cache"
// cache directory
FileCacheFileSuffix
=
".bin"
// cache file suffix
FileCacheFileSuffix
=
".bin"
// cache file suffix
FileCacheDirectoryLevel
=
2
// cache file deep level if auto generated cache files.
FileCacheDirectoryLevel
=
2
// cache file deep level if auto generated cache files.
FileCacheEmbedExpiry
int64
// cache expire time, default is no expire forever.
FileCacheEmbedExpiry
time
.
Duration
=
0
// cache expire time, default is no expire forever.
)
)
// FileCache is cache adapter for file storage.
// FileCache is cache adapter for file storage.
...
@@ -76,7 +76,7 @@ func (fc *FileCache) StartAndGC(config string) error {
...
@@ -76,7 +76,7 @@ func (fc *FileCache) StartAndGC(config string) error {
cfg
[
"DirectoryLevel"
]
=
strconv
.
Itoa
(
FileCacheDirectoryLevel
)
cfg
[
"DirectoryLevel"
]
=
strconv
.
Itoa
(
FileCacheDirectoryLevel
)
}
}
if
_
,
ok
:=
cfg
[
"EmbedExpiry"
];
!
ok
{
if
_
,
ok
:=
cfg
[
"EmbedExpiry"
];
!
ok
{
cfg
[
"EmbedExpiry"
]
=
strconv
.
FormatInt
(
FileCacheEmbedExpiry
,
10
)
cfg
[
"EmbedExpiry"
]
=
strconv
.
FormatInt
(
int64
(
FileCacheEmbedExpiry
.
Seconds
())
,
10
)
}
}
fc
.
CachePath
=
cfg
[
"CachePath"
]
fc
.
CachePath
=
cfg
[
"CachePath"
]
fc
.
FileSuffix
=
cfg
[
"FileSuffix"
]
fc
.
FileSuffix
=
cfg
[
"FileSuffix"
]
...
@@ -123,7 +123,7 @@ func (fc *FileCache) Get(key string) interface{} {
...
@@ -123,7 +123,7 @@ func (fc *FileCache) Get(key string) interface{} {
}
}
var
to
FileCacheItem
var
to
FileCacheItem
GobDecode
(
fileData
,
&
to
)
GobDecode
(
fileData
,
&
to
)
if
to
.
Expired
<
time
.
Now
()
.
Unix
(
)
{
if
to
.
Expired
.
Before
(
time
.
Now
()
)
{
return
""
return
""
}
}
return
to
.
Data
return
to
.
Data
...
@@ -142,16 +142,16 @@ func (fc *FileCache) GetMulti(keys []string) []interface{} {
...
@@ -142,16 +142,16 @@ func (fc *FileCache) GetMulti(keys []string) []interface{} {
// Put value into file cache.
// Put value into file cache.
// timeout means how long to keep this file, unit of ms.
// timeout means how long to keep this file, unit of ms.
// if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever.
// if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever.
func
(
fc
*
FileCache
)
Put
(
key
string
,
val
interface
{},
timeout
int64
)
error
{
func
(
fc
*
FileCache
)
Put
(
key
string
,
val
interface
{},
timeout
time
.
Duration
)
error
{
gob
.
Register
(
val
)
gob
.
Register
(
val
)
item
:=
FileCacheItem
{
Data
:
val
}
item
:=
FileCacheItem
{
Data
:
val
}
if
timeout
==
FileCacheEmbedExpiry
{
if
timeout
==
FileCacheEmbedExpiry
{
item
.
Expired
=
time
.
Now
()
.
Unix
()
+
(
86400
*
365
*
10
)
// ten years
item
.
Expired
=
time
.
Now
()
.
Add
((
86400
*
365
*
10
)
*
time
.
Second
)
// ten years
}
else
{
}
else
{
item
.
Expired
=
time
.
Now
()
.
Unix
()
+
timeout
item
.
Expired
=
time
.
Now
()
.
Add
(
timeout
)
}
}
item
.
Lastaccess
=
time
.
Now
()
.
Unix
()
item
.
Lastaccess
=
time
.
Now
()
data
,
err
:=
GobEncode
(
item
)
data
,
err
:=
GobEncode
(
item
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
cache/memcache/memcache.go
View file @
5befc673
...
@@ -37,6 +37,7 @@ import (
...
@@ -37,6 +37,7 @@ import (
"github.com/bradfitz/gomemcache/memcache"
"github.com/bradfitz/gomemcache/memcache"
"github.com/astaxie/beego/cache"
"github.com/astaxie/beego/cache"
"time"
)
)
// Cache Memcache adapter.
// Cache Memcache adapter.
...
@@ -89,7 +90,7 @@ func (rc *Cache) GetMulti(keys []string) []interface{} {
...
@@ -89,7 +90,7 @@ func (rc *Cache) GetMulti(keys []string) []interface{} {
}
}
// Put put value to memcache. only support string.
// Put put value to memcache. only support string.
func
(
rc
*
Cache
)
Put
(
key
string
,
val
interface
{},
timeout
int64
)
error
{
func
(
rc
*
Cache
)
Put
(
key
string
,
val
interface
{},
timeout
time
.
Duration
)
error
{
if
rc
.
conn
==
nil
{
if
rc
.
conn
==
nil
{
if
err
:=
rc
.
connectInit
();
err
!=
nil
{
if
err
:=
rc
.
connectInit
();
err
!=
nil
{
return
err
return
err
...
@@ -99,7 +100,7 @@ func (rc *Cache) Put(key string, val interface{}, timeout int64) error {
...
@@ -99,7 +100,7 @@ func (rc *Cache) Put(key string, val interface{}, timeout int64) error {
if
!
ok
{
if
!
ok
{
return
errors
.
New
(
"val must string"
)
return
errors
.
New
(
"val must string"
)
}
}
item
:=
memcache
.
Item
{
Key
:
key
,
Value
:
[]
byte
(
v
),
Expiration
:
int32
(
timeout
)}
item
:=
memcache
.
Item
{
Key
:
key
,
Value
:
[]
byte
(
v
),
Expiration
:
int32
(
timeout
/
time
.
Second
)}
return
rc
.
conn
.
Set
(
&
item
)
return
rc
.
conn
.
Set
(
&
item
)
}
}
...
...
cache/memcache/memcache_test.go
View file @
5befc673
...
@@ -28,7 +28,8 @@ func TestMemcacheCache(t *testing.T) {
...
@@ -28,7 +28,8 @@ func TestMemcacheCache(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"init err"
)
t
.
Error
(
"init err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
"1"
,
10
);
err
!=
nil
{
timeoutDuration
:=
10
*
time
.
Second
if
err
=
bm
.
Put
(
"astaxie"
,
"1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -40,7 +41,7 @@ func TestMemcacheCache(t *testing.T) {
...
@@ -40,7 +41,7 @@ func TestMemcacheCache(t *testing.T) {
if
bm
.
IsExist
(
"astaxie"
)
{
if
bm
.
IsExist
(
"astaxie"
)
{
t
.
Error
(
"check err"
)
t
.
Error
(
"check err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
"1"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
"1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
...
@@ -69,7 +70,7 @@ func TestMemcacheCache(t *testing.T) {
...
@@ -69,7 +70,7 @@ func TestMemcacheCache(t *testing.T) {
}
}
//test string
//test string
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -81,7 +82,7 @@ func TestMemcacheCache(t *testing.T) {
...
@@ -81,7 +82,7 @@ func TestMemcacheCache(t *testing.T) {
}
}
//test GetMulti
//test GetMulti
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie1"
)
{
if
!
bm
.
IsExist
(
"astaxie1"
)
{
...
...
cache/memory.go
View file @
5befc673
...
@@ -17,7 +17,6 @@ package cache
...
@@ -17,7 +17,6 @@ package cache
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"sync"
"sync"
"time"
"time"
)
)
...
@@ -31,7 +30,7 @@ var (
...
@@ -31,7 +30,7 @@ var (
type
MemoryItem
struct
{
type
MemoryItem
struct
{
val
interface
{}
val
interface
{}
createdTime
time
.
Time
createdTime
time
.
Time
lifespan
int64
lifespan
time
.
Duration
}
}
func
(
mi
*
MemoryItem
)
isExpire
()
bool
{
func
(
mi
*
MemoryItem
)
isExpire
()
bool
{
...
@@ -39,7 +38,7 @@ func (mi *MemoryItem) isExpire() bool {
...
@@ -39,7 +38,7 @@ func (mi *MemoryItem) isExpire() bool {
if
mi
.
lifespan
==
0
{
if
mi
.
lifespan
==
0
{
return
false
return
false
}
}
return
time
.
Now
()
.
Unix
()
-
mi
.
createdTime
.
Unix
(
)
>
mi
.
lifespan
return
time
.
Now
()
.
Sub
(
mi
.
createdTime
)
>
mi
.
lifespan
}
}
// MemoryCache is Memory cache adapter.
// MemoryCache is Memory cache adapter.
...
@@ -83,7 +82,7 @@ func (bc *MemoryCache) GetMulti(names []string) []interface{} {
...
@@ -83,7 +82,7 @@ func (bc *MemoryCache) GetMulti(names []string) []interface{} {
// Put cache to memory.
// Put cache to memory.
// if lifespan is 0, it will be forever till restart.
// if lifespan is 0, it will be forever till restart.
func
(
bc
*
MemoryCache
)
Put
(
name
string
,
value
interface
{},
lifespan
int64
)
error
{
func
(
bc
*
MemoryCache
)
Put
(
name
string
,
value
interface
{},
lifespan
time
.
Duration
)
error
{
bc
.
Lock
()
bc
.
Lock
()
defer
bc
.
Unlock
()
defer
bc
.
Unlock
()
bc
.
items
[
name
]
=
&
MemoryItem
{
bc
.
items
[
name
]
=
&
MemoryItem
{
...
@@ -201,10 +200,7 @@ func (bc *MemoryCache) StartAndGC(config string) error {
...
@@ -201,10 +200,7 @@ func (bc *MemoryCache) StartAndGC(config string) error {
cf
=
make
(
map
[
string
]
int
)
cf
=
make
(
map
[
string
]
int
)
cf
[
"interval"
]
=
DefaultEvery
cf
[
"interval"
]
=
DefaultEvery
}
}
dur
,
err
:=
time
.
ParseDuration
(
fmt
.
Sprintf
(
"%ds"
,
cf
[
"interval"
]))
dur
:=
time
.
Duration
(
cf
[
"interval"
])
*
time
.
Second
if
err
!=
nil
{
return
err
}
bc
.
Every
=
cf
[
"interval"
]
bc
.
Every
=
cf
[
"interval"
]
bc
.
dur
=
dur
bc
.
dur
=
dur
go
bc
.
vaccuum
()
go
bc
.
vaccuum
()
...
...
cache/redis/redis.go
View file @
5befc673
...
@@ -109,9 +109,9 @@ ERROR:
...
@@ -109,9 +109,9 @@ ERROR:
}
}
// Put put cache to redis.
// Put put cache to redis.
func
(
rc
*
Cache
)
Put
(
key
string
,
val
interface
{},
timeout
int64
)
error
{
func
(
rc
*
Cache
)
Put
(
key
string
,
val
interface
{},
timeout
time
.
Duration
)
error
{
var
err
error
var
err
error
if
_
,
err
=
rc
.
do
(
"SETEX"
,
key
,
timeout
,
val
);
err
!=
nil
{
if
_
,
err
=
rc
.
do
(
"SETEX"
,
key
,
int64
(
timeout
/
time
.
Second
)
,
val
);
err
!=
nil
{
return
err
return
err
}
}
...
...
cache/redis/redis_test.go
View file @
5befc673
...
@@ -28,7 +28,8 @@ func TestRedisCache(t *testing.T) {
...
@@ -28,7 +28,8 @@ func TestRedisCache(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"init err"
)
t
.
Error
(
"init err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
10
);
err
!=
nil
{
timeoutDuration
:=
10
*
time
.
Second
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -40,7 +41,7 @@ func TestRedisCache(t *testing.T) {
...
@@ -40,7 +41,7 @@ func TestRedisCache(t *testing.T) {
if
bm
.
IsExist
(
"astaxie"
)
{
if
bm
.
IsExist
(
"astaxie"
)
{
t
.
Error
(
"check err"
)
t
.
Error
(
"check err"
)
}
}
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
1
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
...
@@ -69,7 +70,7 @@ func TestRedisCache(t *testing.T) {
...
@@ -69,7 +70,7 @@ func TestRedisCache(t *testing.T) {
}
}
//test string
//test string
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie"
,
"author"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie"
)
{
if
!
bm
.
IsExist
(
"astaxie"
)
{
...
@@ -81,7 +82,7 @@ func TestRedisCache(t *testing.T) {
...
@@ -81,7 +82,7 @@ func TestRedisCache(t *testing.T) {
}
}
//test GetMulti
//test GetMulti
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
10
);
err
!=
nil
{
if
err
=
bm
.
Put
(
"astaxie1"
,
"author1"
,
timeoutDuration
);
err
!=
nil
{
t
.
Error
(
"set Error"
,
err
)
t
.
Error
(
"set Error"
,
err
)
}
}
if
!
bm
.
IsExist
(
"astaxie1"
)
{
if
!
bm
.
IsExist
(
"astaxie1"
)
{
...
...
config.go
View file @
5befc673
...
@@ -44,15 +44,15 @@ type Listen struct {
...
@@ -44,15 +44,15 @@ type Listen struct {
Graceful
bool
// Graceful means use graceful module to start the server
Graceful
bool
// Graceful means use graceful module to start the server
ServerTimeOut
int64
ServerTimeOut
int64
ListenTCP4
bool
ListenTCP4
bool
HTTPEnable
bool
EnableHTTP
bool
HTTPAddr
string
HTTPAddr
string
HTTPPort
int
HTTPPort
int
HTTPSEnable
bool
EnableHTTPS
bool
HTTPSAddr
string
HTTPSAddr
string
HTTPSPort
int
HTTPSPort
int
HTTPSCertFile
string
HTTPSCertFile
string
HTTPSKeyFile
string
HTTPSKeyFile
string
AdminEnable
bool
EnableAdmin
bool
AdminAddr
string
AdminAddr
string
AdminPort
int
AdminPort
int
EnableFcgi
bool
EnableFcgi
bool
...
@@ -123,15 +123,15 @@ func init() {
...
@@ -123,15 +123,15 @@ func init() {
Graceful
:
false
,
Graceful
:
false
,
ServerTimeOut
:
0
,
ServerTimeOut
:
0
,
ListenTCP4
:
false
,
ListenTCP4
:
false
,
HTTPEnable
:
true
,
EnableHTTP
:
true
,
HTTPAddr
:
""
,
HTTPAddr
:
""
,
HTTPPort
:
8080
,
HTTPPort
:
8080
,
HTTPSEnable
:
false
,
EnableHTTPS
:
false
,
HTTPSAddr
:
""
,
HTTPSAddr
:
""
,
HTTPSPort
:
10443
,
HTTPSPort
:
10443
,
HTTPSCertFile
:
""
,
HTTPSCertFile
:
""
,
HTTPSKeyFile
:
""
,
HTTPSKeyFile
:
""
,
AdminEnable
:
false
,
EnableAdmin
:
false
,
AdminAddr
:
""
,
AdminAddr
:
""
,
AdminPort
:
8088
,
AdminPort
:
8088
,
EnableFcgi
:
false
,
EnableFcgi
:
false
,
...
@@ -196,7 +196,7 @@ func ParseConfig() (err error) {
...
@@ -196,7 +196,7 @@ func ParseConfig() (err error) {
BConfig
.
AppName
=
AppConfig
.
DefaultString
(
"AppName"
,
BConfig
.
AppName
)
BConfig
.
AppName
=
AppConfig
.
DefaultString
(
"AppName"
,
BConfig
.
AppName
)
BConfig
.
RecoverPanic
=
AppConfig
.
DefaultBool
(
"RecoverPanic"
,
BConfig
.
RecoverPanic
)
BConfig
.
RecoverPanic
=
AppConfig
.
DefaultBool
(
"RecoverPanic"
,
BConfig
.
RecoverPanic
)
BConfig
.
RouterCaseSensitive
=
AppConfig
.
DefaultBool
(
"RouterCaseSensitive"
,
BConfig
.
RouterCaseSensitive
)
BConfig
.
RouterCaseSensitive
=
AppConfig
.
DefaultBool
(
"RouterCaseSensitive"
,
BConfig
.
RouterCaseSensitive
)
BConfig
.
ServerName
=
AppConfig
.
DefaultString
(
"
Beego
ServerName"
,
BConfig
.
ServerName
)
BConfig
.
ServerName
=
AppConfig
.
DefaultString
(
"ServerName"
,
BConfig
.
ServerName
)
BConfig
.
EnableGzip
=
AppConfig
.
DefaultBool
(
"EnableGzip"
,
BConfig
.
EnableGzip
)
BConfig
.
EnableGzip
=
AppConfig
.
DefaultBool
(
"EnableGzip"
,
BConfig
.
EnableGzip
)
BConfig
.
EnableErrorsShow
=
AppConfig
.
DefaultBool
(
"EnableErrorsShow"
,
BConfig
.
EnableErrorsShow
)
BConfig
.
EnableErrorsShow
=
AppConfig
.
DefaultBool
(
"EnableErrorsShow"
,
BConfig
.
EnableErrorsShow
)
BConfig
.
CopyRequestBody
=
AppConfig
.
DefaultBool
(
"CopyRequestBody"
,
BConfig
.
CopyRequestBody
)
BConfig
.
CopyRequestBody
=
AppConfig
.
DefaultBool
(
"CopyRequestBody"
,
BConfig
.
CopyRequestBody
)
...
@@ -205,18 +205,18 @@ func ParseConfig() (err error) {
...
@@ -205,18 +205,18 @@ func ParseConfig() (err error) {
BConfig
.
Listen
.
HTTPAddr
=
AppConfig
.
String
(
"HTTPAddr"
)
BConfig
.
Listen
.
HTTPAddr
=
AppConfig
.
String
(
"HTTPAddr"
)
BConfig
.
Listen
.
HTTPPort
=
AppConfig
.
DefaultInt
(
"HTTPPort"
,
BConfig
.
Listen
.
HTTPPort
)
BConfig
.
Listen
.
HTTPPort
=
AppConfig
.
DefaultInt
(
"HTTPPort"
,
BConfig
.
Listen
.
HTTPPort
)
BConfig
.
Listen
.
ListenTCP4
=
AppConfig
.
DefaultBool
(
"ListenTCP4"
,
BConfig
.
Listen
.
ListenTCP4
)
BConfig
.
Listen
.
ListenTCP4
=
AppConfig
.
DefaultBool
(
"ListenTCP4"
,
BConfig
.
Listen
.
ListenTCP4
)
BConfig
.
Listen
.
HTTPEnable
=
AppConfig
.
DefaultBool
(
"EnableHTTPListen"
,
BConfig
.
Listen
.
HTTPEnable
)
BConfig
.
Listen
.
EnableHTTP
=
AppConfig
.
DefaultBool
(
"EnableHTTP"
,
BConfig
.
Listen
.
EnableHTTP
)
BConfig
.
Listen
.
HTTPSEnable
=
AppConfig
.
DefaultBool
(
"EnableHTTPTLS"
,
BConfig
.
Listen
.
HTTPSEnable
)
BConfig
.
Listen
.
EnableHTTPS
=
AppConfig
.
DefaultBool
(
"EnableHTTPS"
,
BConfig
.
Listen
.
EnableHTTPS
)
BConfig
.
Listen
.
HTTPSAddr
=
AppConfig
.
DefaultString
(
"HTTPSAddr"
,
BConfig
.
Listen
.
HTTPSAddr
)
BConfig
.
Listen
.
HTTPSAddr
=
AppConfig
.
DefaultString
(
"HTTPSAddr"
,
BConfig
.
Listen
.
HTTPSAddr
)
BConfig
.
Listen
.
HTTPSPort
=
AppConfig
.
DefaultInt
(
"HTTPSPort"
,
BConfig
.
Listen
.
HTTPSPort
)
BConfig
.
Listen
.
HTTPSPort
=
AppConfig
.
DefaultInt
(
"HTTPSPort"
,
BConfig
.
Listen
.
HTTPSPort
)
BConfig
.
Listen
.
HTTPSCertFile
=
AppConfig
.
DefaultString
(
"HTTPCertFile"
,
BConfig
.
Listen
.
HTTPSCertFile
)
BConfig
.
Listen
.
HTTPSCertFile
=
AppConfig
.
DefaultString
(
"HTTP
S
CertFile"
,
BConfig
.
Listen
.
HTTPSCertFile
)
BConfig
.
Listen
.
HTTPSKeyFile
=
AppConfig
.
DefaultString
(
"HTTPKeyFile"
,
BConfig
.
Listen
.
HTTPSKeyFile
)
BConfig
.
Listen
.
HTTPSKeyFile
=
AppConfig
.
DefaultString
(
"HTTP
S
KeyFile"
,
BConfig
.
Listen
.
HTTPSKeyFile
)
BConfig
.
Listen
.
AdminEnable
=
AppConfig
.
DefaultBool
(
"EnableAdmin"
,
BConfig
.
Listen
.
AdminEnable
)
BConfig
.
Listen
.
EnableAdmin
=
AppConfig
.
DefaultBool
(
"EnableAdmin"
,
BConfig
.
Listen
.
EnableAdmin
)
BConfig
.
Listen
.
AdminAddr
=
AppConfig
.
DefaultString
(
"Admin
HTTP
Addr"
,
BConfig
.
Listen
.
AdminAddr
)
BConfig
.
Listen
.
AdminAddr
=
AppConfig
.
DefaultString
(
"AdminAddr"
,
BConfig
.
Listen
.
AdminAddr
)
BConfig
.
Listen
.
AdminPort
=
AppConfig
.
DefaultInt
(
"Admin
HTTP
Port"
,
BConfig
.
Listen
.
AdminPort
)
BConfig
.
Listen
.
AdminPort
=
AppConfig
.
DefaultInt
(
"AdminPort"
,
BConfig
.
Listen
.
AdminPort
)
BConfig
.
Listen
.
EnableFcgi
=
AppConfig
.
DefaultBool
(
"EnableFcgi"
,
BConfig
.
Listen
.
EnableFcgi
)
BConfig
.
Listen
.
EnableFcgi
=
AppConfig
.
DefaultBool
(
"EnableFcgi"
,
BConfig
.
Listen
.
EnableFcgi
)
BConfig
.
Listen
.
EnableStdIo
=
AppConfig
.
DefaultBool
(
"EnableStdIo"
,
BConfig
.
Listen
.
EnableStdIo
)
BConfig
.
Listen
.
EnableStdIo
=
AppConfig
.
DefaultBool
(
"EnableStdIo"
,
BConfig
.
Listen
.
EnableStdIo
)
BConfig
.
Listen
.
ServerTimeOut
=
AppConfig
.
DefaultInt64
(
"
HTTP
ServerTimeOut"
,
BConfig
.
Listen
.
ServerTimeOut
)
BConfig
.
Listen
.
ServerTimeOut
=
AppConfig
.
DefaultInt64
(
"ServerTimeOut"
,
BConfig
.
Listen
.
ServerTimeOut
)
BConfig
.
WebConfig
.
AutoRender
=
AppConfig
.
DefaultBool
(
"AutoRender"
,
BConfig
.
WebConfig
.
AutoRender
)
BConfig
.
WebConfig
.
AutoRender
=
AppConfig
.
DefaultBool
(
"AutoRender"
,
BConfig
.
WebConfig
.
AutoRender
)
BConfig
.
WebConfig
.
ViewsPath
=
AppConfig
.
DefaultString
(
"ViewsPath"
,
BConfig
.
WebConfig
.
ViewsPath
)
BConfig
.
WebConfig
.
ViewsPath
=
AppConfig
.
DefaultString
(
"ViewsPath"
,
BConfig
.
WebConfig
.
ViewsPath
)
BConfig
.
WebConfig
.
DirectoryIndex
=
AppConfig
.
DefaultBool
(
"DirectoryIndex"
,
BConfig
.
WebConfig
.
DirectoryIndex
)
BConfig
.
WebConfig
.
DirectoryIndex
=
AppConfig
.
DefaultBool
(
"DirectoryIndex"
,
BConfig
.
WebConfig
.
DirectoryIndex
)
...
...
hooks.go
View file @
5befc673
...
@@ -48,7 +48,7 @@ func registerSession() error {
...
@@ -48,7 +48,7 @@ func registerSession() error {
"cookieName"
:
BConfig
.
WebConfig
.
Session
.
SessionName
,
"cookieName"
:
BConfig
.
WebConfig
.
Session
.
SessionName
,
"gclifetime"
:
BConfig
.
WebConfig
.
Session
.
SessionGCMaxLifetime
,
"gclifetime"
:
BConfig
.
WebConfig
.
Session
.
SessionGCMaxLifetime
,
"providerConfig"
:
filepath
.
ToSlash
(
BConfig
.
WebConfig
.
Session
.
SessionProviderConfig
),
"providerConfig"
:
filepath
.
ToSlash
(
BConfig
.
WebConfig
.
Session
.
SessionProviderConfig
),
"secure"
:
BConfig
.
Listen
.
HTTPSEnable
,
"secure"
:
BConfig
.
Listen
.
EnableHTTPS
,
"enableSetCookie"
:
BConfig
.
WebConfig
.
Session
.
SessionAutoSetCookie
,
"enableSetCookie"
:
BConfig
.
WebConfig
.
Session
.
SessionAutoSetCookie
,
"domain"
:
BConfig
.
WebConfig
.
Session
.
SessionDomain
,
"domain"
:
BConfig
.
WebConfig
.
Session
.
SessionDomain
,
"cookieLifeTime"
:
BConfig
.
WebConfig
.
Session
.
SessionCookieLifeTime
,
"cookieLifeTime"
:
BConfig
.
WebConfig
.
Session
.
SessionCookieLifeTime
,
...
@@ -88,7 +88,7 @@ func registerDocs() error {
...
@@ -88,7 +88,7 @@ func registerDocs() error {
}
}
func
registerAdmin
()
error
{
func
registerAdmin
()
error
{
if
BConfig
.
Listen
.
AdminEnable
{
if
BConfig
.
Listen
.
EnableAdmin
{
go
beeAdminApp
.
Run
()
go
beeAdminApp
.
Run
()
}
}
return
nil
return
nil
...
...
router.go
View file @
5befc673
...
@@ -609,7 +609,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
...
@@ -609,7 +609,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
defer
p
.
pool
.
Put
(
context
)
defer
p
.
pool
.
Put
(
context
)
defer
p
.
recoverPanic
(
context
)
defer
p
.
recoverPanic
(
context
)
context
.
Output
.
EnableGzip
=
BConfig
.
EnableGzip
context
.
Output
.
EnableGzip
=
BConfig
.
EnableGzip
if
BConfig
.
RunMode
==
DEV
{
if
BConfig
.
RunMode
==
DEV
{
context
.
Output
.
Header
(
"Server"
,
BConfig
.
ServerName
)
context
.
Output
.
Header
(
"Server"
,
BConfig
.
ServerName
)
...
@@ -800,7 +800,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
...
@@ -800,7 +800,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
Admin
:
Admin
:
timeDur
:=
time
.
Since
(
startTime
)
timeDur
:=
time
.
Since
(
startTime
)
//admin module record QPS
//admin module record QPS
if
BConfig
.
Listen
.
AdminEnable
{
if
BConfig
.
Listen
.
EnableAdmin
{
if
FilterMonitorFunc
(
r
.
Method
,
r
.
URL
.
Path
,
timeDur
)
{
if
FilterMonitorFunc
(
r
.
Method
,
r
.
URL
.
Path
,
timeDur
)
{
if
runRouter
!=
nil
{
if
runRouter
!=
nil
{
go
toolbox
.
StatisticsMap
.
AddStatistics
(
r
.
Method
,
r
.
URL
.
Path
,
runRouter
.
Name
(),
timeDur
)
go
toolbox
.
StatisticsMap
.
AddStatistics
(
r
.
Method
,
r
.
URL
.
Path
,
runRouter
.
Name
(),
timeDur
)
...
...
utils/captcha/captcha.go
View file @
5befc673
...
@@ -64,6 +64,7 @@ import (
...
@@ -64,6 +64,7 @@ import (
"net/http"
"net/http"
"path"
"path"
"strings"
"strings"
"time"
"github.com/astaxie/beego"
"github.com/astaxie/beego"
"github.com/astaxie/beego/cache"
"github.com/astaxie/beego/cache"
...
@@ -78,7 +79,7 @@ var (
...
@@ -78,7 +79,7 @@ var (
const
(
const
(
// default captcha attributes
// default captcha attributes
challengeNums
=
6
challengeNums
=
6
expiration
=
600
expiration
=
600
*
time
.
Second
fieldIDName
=
"captcha_id"
fieldIDName
=
"captcha_id"
fieldCaptchaName
=
"captcha"
fieldCaptchaName
=
"captcha"
cachePrefix
=
"captcha_"
cachePrefix
=
"captcha_"
...
@@ -106,7 +107,7 @@ type Captcha struct {
...
@@ -106,7 +107,7 @@ type Captcha struct {
ChallengeNums
int
ChallengeNums
int
// captcha expiration seconds
// captcha expiration seconds
Expiration
int64
Expiration
time
.
Duration
// cache key prefix
// cache key prefix
CachePrefix
string
CachePrefix
string
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment