diff --git a/Cache-Remote-Storage.md b/Cache-Remote-Storage.md new file mode 100644 index 0000000..57aa104 --- /dev/null +++ b/Cache-Remote-Storage.md @@ -0,0 +1,33 @@ +After [[Mount Remote Storage]], you can already read or write files in the mounted directory. + +However, sometimes you want to have a command to cache file content directly, instead of find the file, trigger one read in order to cache the file content. + +And sometimes you may want to reduce local storage usage, to `uncache` the file content. + +## Cache Mounted File Content +In `weed shell`, checkout `remote.cache` and `remote.uncache`: + +``` +> help remote.cache + remote.cache # cache the file content for mounted directories or files + + # assume a remote storage is configured to name "s3_1" + remote.configure -name=s3_1 -type=s3 -access_key=xxx -secret_key=yyy + # mount and pull one bucket + remote.mount -dir=xxx -remote=s3_1/bucket + + # after mount, run one of these command to cache the content of the files + remote.cache -dir=xxx + remote.cache -dir=xxx/some/sub/dir + +> help remote.uncache + remote.uncache # keep the metadata but remote cache the file content for mounted directories or files + + remote.uncache -dir=xxx + remote.uncache -dir=xxx/some/sub/dir + +``` + +## Note + +If you want some more flexibility to decide which file to cache or uncache, please help to send a PR.