This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
package pokeapi
|
||||
|
||||
import (
|
||||
"github.com/rdarius/boot-dev-pokedex/pokecache"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Client -
|
||||
type Client struct {
|
||||
cache pokecache.Cache
|
||||
httpClient http.Client
|
||||
}
|
||||
|
||||
// NewClient -
|
||||
func NewClient(timeout time.Duration) Client {
|
||||
func NewClient(timeout, cacheInterval time.Duration) Client {
|
||||
return Client{
|
||||
cache: pokecache.NewCache(cacheInterval),
|
||||
httpClient: http.Client{
|
||||
Timeout: timeout,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user