aboutsummaryrefslogtreecommitdiff
path: root/navitia_api_client/client.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--navitia_api_client/client.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/navitia_api_client/client.go b/navitia_api_client/client.go
index d08ca19..aef8d0e 100644
--- a/navitia_api_client/client.go
+++ b/navitia_api_client/client.go
@@ -3,12 +3,21 @@ package navitia_api_client
import (
"fmt"
"net/http"
+ "sync"
"time"
)
type Client struct {
baseURL string
httpClient *http.Client
+
+ mutex sync.Mutex
+ cache map[string]cachedResult
+}
+
+type cachedResult struct {
+ ts time.Time
+ result interface{}
}
func NewClient(token string) *Client {
@@ -17,5 +26,6 @@ func NewClient(token string) *Client {
httpClient: &http.Client{
Timeout: time.Minute,
},
+ cache: make(map[string]cachedResult),
}
}