@@ -17,15 +17,15 @@ func getCacheFilePath(endpoint string) string {
1717 return filepath .Join (".ditto" , hashedEndpoint )
1818}
1919
20- func loadCache (endpoint string ) ([]byte , error ) {
20+ func retrieve (endpoint string ) ([]byte , error ) {
2121 cacheFilePath := getCacheFilePath (endpoint )
2222 if _ , err := os .Stat (cacheFilePath ); os .IsNotExist (err ) {
2323 return nil , err
2424 }
2525 return os .ReadFile (cacheFilePath )
2626}
2727
28- func saveCache (endpoint string , data []byte ) error {
28+ func cache (endpoint string , data []byte ) error {
2929 cacheFilePath := getCacheFilePath (endpoint )
3030 os .MkdirAll (filepath .Dir (cacheFilePath ), os .ModePerm )
3131 return os .WriteFile (cacheFilePath , data , 0644 )
@@ -38,7 +38,7 @@ type CachingHTTPClient struct {
3838func (c * CachingHTTPClient ) RoundTrip (req * http.Request ) (* http.Response , error ) {
3939 endpoint := req .URL .String ()
4040
41- data , err := loadCache (endpoint )
41+ data , err := retrieve (endpoint )
4242 if err == nil {
4343 reader := io .NopCloser (bytes .NewReader (data ))
4444 return & http.Response {
@@ -57,7 +57,7 @@ func (c *CachingHTTPClient) RoundTrip(req *http.Request) (*http.Response, error)
5757 return nil , err
5858 }
5959
60- err = saveCache (endpoint , data )
60+ err = cache (endpoint , data )
6161 if err != nil {
6262 return nil , err
6363 }
0 commit comments