Skip to content

Commit 49cceeb

Browse files
committed
Add Repository caching section to documentation
1 parent a314b33 commit 49cceeb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,30 @@ You can combine the options of the Mbed update command for the following scenari
851851

852852
Use these with caution because your uncommitted changes and unpublished libraries cannot be restored.
853853

854+
## Repository caching
855+
856+
To minimize traffic and reduce import times, by default Mbed CLI would cache repositories by storing their indexes under the Mbed CLI user config folder - typically `~/.mbed/mbed-cache/` on UNIX systems, or `%userprofile%/.mbed/mbed-cache/` on Windows systems. Compared to a fully checked out repository, indexes are significantly smaller in size and number of files, and contain the whole revision history of that repository. This allows Mbed CLI to quickly create copies of previously downloaded repository indexes and pull/fetch only the latest changes from the remote repositories, therefore dramatically reducing network traffic and download times, especially for big repositories like `mbed-os`.
857+
858+
You can manage the Mbed CLI caching behavior with the following sub-commands:
859+
860+
```
861+
mbed cache [on|off|dir <path>|ls|purge|-h|--help]
862+
```
863+
864+
* `on` - Turn repository caching on. Will use either the default or the user specified cache directory.
865+
* `off` - Turn repository caching off. Note that this doesn't purge cached repositories. See "purge".
866+
* 'dir' - Set cache directory. Set to "default" to let mbed CLI determine the cache directory location. Typically this is `~/.mbed/mbed-cache/` on UNIX systems, or `%%userprofile%%/.mbed/mbed-cache/` on Windows systems.
867+
* `ls` - List cached repositories and their size.
868+
* `purge` - Purge cached repositories. Note that this doesn't turn caching off.
869+
* `-h` or `--help` - Print cache command options.
870+
871+
If no sub-command is specified to `mbed cache`, then mbed CLI would print the current cache setting (ENABLED or DISABLED) and the path to the local cache directory.
872+
873+
For safety reasons, Mbed CLI will always use `mbed-cache` subfolder to a user specified location. This ensure that no user files will deleted during `purge` even if the user has specified root/system folder as a cache location (e.g. `mbed cache dir /` or `mbed cache dir C:\`).
874+
875+
**Security notice: It's generally recommended to user cache location inside your own home directory. If you use cache location outside your user home/profile, then other system users might be able to access the repository cache and therefore the data of the cached repositories**
876+
877+
854878
## Mbed CLI configuration
855879

856880
You can streamline many options in Mbed CLI with global and local configuration.
@@ -874,7 +898,7 @@ Here is a list of configuration settings and their defaults:
874898
* `ARM_PATH`, `ARMC6_PATH`, `GCC_ARM_PATH`, `IAR_PATH` - defines the path to Arm Compiler 5 and 6, GCC Arm and IAR Workbench toolchains. Default: none.
875899
* `protocol` - defines the default protocol used for importing or cloning of programs and libraries. The possible values are `https`, `http` and `ssh`. Use `ssh` if you have generated and registered SSH keys (Public Key Authentication) with a service such as GitHub, GitLab, Bitbucket and so on. Read more about SSH keys [here](https://help.github.com/articles/generating-an-ssh-key/). Default: `https`.
876900
* `depth` - defines the *clone* depth for importing or cloning and applies only to *Git* repositories. Note that though this option may improve cloning speed, it may also prevent you from correctly checking out a dependency tree when the reference revision hash is older than the clone depth. Read more about shallow clones [here](https://git-scm.com/docs/git-clone). Default: none.
877-
* `cache` - defines the local path that stores small copies of the imported or cloned repositories, and Mbed CLI uses it to minimize traffic and speed up future imports of the same repositories. Use `on` or `enabled` to turn on caching in the system temp path. Use `none` to turn caching off. Default: none (disabled).
901+
* `cache` - defines the local path that stores small copies of the imported or cloned repositories, and Mbed CLI uses it to minimize traffic and speed up future imports of the same repositories. Use `off` or `disabled` to turn off repository caching. Use `none` to turn caching off. Default: on (in ~/.mbed/mbed-cache/).
878902

879903
## Troubleshooting
880904

0 commit comments

Comments
 (0)