feat: clear cache after change

This commit is contained in:
Noah Hsu
2022-06-30 22:51:49 +08:00
parent 2b1726614b
commit 53416172e7
5 changed files with 31 additions and 3 deletions

View File

@ -267,6 +267,7 @@ func (h *Handler) handleDelete(w http.ResponseWriter, r *http.Request) (status i
if err := fs.Remove(ctx, reqPath); err != nil {
return http.StatusMethodNotAllowed, err
}
fs.ClearCache(path.Dir(reqPath))
return http.StatusNoContent, nil
}
@ -311,6 +312,7 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
return http.StatusInternalServerError, err
}
w.Header().Set("ETag", etag)
fs.ClearCache(path.Dir(reqPath))
return http.StatusCreated, nil
}
@ -338,6 +340,7 @@ func (h *Handler) handleMkcol(w http.ResponseWriter, r *http.Request) (status in
}
return http.StatusMethodNotAllowed, err
}
fs.ClearCache(path.Dir(reqPath))
return http.StatusCreated, nil
}