Added Fetcher
This commit is contained in:
parent
b823cffe69
commit
40f1687972
10 changed files with 36 additions and 19 deletions
|
|
@ -10,6 +10,14 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetClient(t *testing.T) {
|
||||
c := GetClient()
|
||||
assert.Equal(t, CacheExpiration, c.Expiration)
|
||||
assert.Equal(t, 0, c.Storage.Options().DB)
|
||||
assert.Equal(t, HostName, c.Storage.Options().Addr)
|
||||
assert.Equal(t, Password, c.Storage.Options().Password)
|
||||
}
|
||||
|
||||
func TestGetSet(t *testing.T) {
|
||||
client, s := getTestClient()
|
||||
defer s.Close()
|
||||
|
|
|
|||
|
|
@ -10,13 +10,8 @@ type CacheClient struct {
|
|||
Expiration time.Duration
|
||||
}
|
||||
|
||||
var client *CacheClient
|
||||
|
||||
func GetClient() *CacheClient {
|
||||
if client != nil {
|
||||
return client
|
||||
}
|
||||
client = new(CacheClient)
|
||||
client := new(CacheClient)
|
||||
client.Init()
|
||||
return client
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue