This commit is contained in:
2025-03-10 22:20:51 +02:00
parent 0148583f5b
commit cd8c2ee09e
6 changed files with 156 additions and 12 deletions

View File

@@ -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,
},