docs updated
This commit is contained in:
parent
b8a927d26c
commit
4226ecc59d
3 changed files with 7 additions and 15 deletions
2
cache/cache.go
vendored
2
cache/cache.go
vendored
|
@ -3,7 +3,7 @@
|
|||
// which can be found in the LICENSE file.
|
||||
|
||||
// Package storage provides a generic interface for manipulating a
|
||||
// BitTorrent tracker's cache.
|
||||
// BitTorrent tracker's fast moving data.
|
||||
package cache
|
||||
|
||||
import (
|
||||
|
|
19
cache/redis/redis.go
vendored
19
cache/redis/redis.go
vendored
|
@ -5,9 +5,12 @@
|
|||
// Package redis implements the storage interface for a BitTorrent tracker.
|
||||
//
|
||||
// The client whitelist is represented as a set with the key name "whitelist"
|
||||
// with an optional prefix. Torrents and users are JSON-formatted strings.
|
||||
// with an optional prefix. Torrents and users are represented as hashes.
|
||||
// Torrents' keys are named "torrent:<infohash>" with an optional prefix.
|
||||
// Users' keys are named "user:<passkey>" with an optional prefix.
|
||||
// Users' keys are named "user:<passkey>" with an optional prefix. The
|
||||
// seeders and leechers attributes of torrent hashes are strings that represent
|
||||
// the key for those hashes within redis. This is done because redis cannot
|
||||
// nest their hash data type.
|
||||
package redis
|
||||
|
||||
import (
|
||||
|
@ -38,17 +41,7 @@ func (d *driver) New(conf *config.Cache) cache.Pool {
|
|||
|
||||
func makeDialFunc(conf *config.Cache) func() (redis.Conn, error) {
|
||||
return func() (conn redis.Conn, err error) {
|
||||
if conf.ConnTimeout != nil {
|
||||
conn, err = redis.DialTimeout(
|
||||
conf.Network,
|
||||
conf.Addr,
|
||||
conf.ConnTimeout.Duration, // Connect Timeout
|
||||
conf.ConnTimeout.Duration, // Read Timeout
|
||||
conf.ConnTimeout.Duration, // Write Timeout
|
||||
)
|
||||
} else {
|
||||
conn, err = redis.Dial(conf.Network, conf.Addr)
|
||||
}
|
||||
conn, err = redis.Dial(conf.Network, conf.Addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ type Cache struct {
|
|||
|
||||
MaxIdleConn int `json:"max_idle_conn"`
|
||||
IdleTimeout *Duration `json:"idle_timeout"`
|
||||
ConnTimeout *Duration `json:"conn_timeout"`
|
||||
TxRetries int `json:"tx_retries"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue