add constructor to allservers package

This commit is contained in:
Dawid Wysokiński 2020-07-28 12:27:48 +02:00
parent e9db0f1975
commit ba26badae6
1 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,10 @@ type allServersCache struct {
client redis.UniversalClient
}
func New(client redis.UniversalClient) AllServersCache {
return &allServersCache{client}
}
func (c *allServersCache) Get() ([]*models.Server, bool) {
sJSON, err := c.client.Get(context.Background(), key).Result()
if sJSON == "" || err != nil {