<commit_before>---
date: 2017-04-11T00:00:00+00:00
title: SFTP Cache
author: appleboy
tags: [ publish, ssh, sftp, cache ]
repo: appleboy/drone-sftp-cache
logo: sftp_cache.svg
image: appleboy/drone-sftp-cache
---

Use this plugin for caching build artifacts to speed up your build times. This plugin can create and restore caches of any folders.

```yaml
pipeline:
  restore_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
    path: /var/cache/drone
    restore: true
    mount:
      - node_modules

  build:
    image: node:latest
    commands:
      - npm install

  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
    path: /var/cache/drone
    rebuild: true
    mount:
      - node_modules
```

Example configuration for login with user private key:

```diff
pipeline:
  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
-   password: <PASSWORD>
+   key: plain_text_of_user_private_key
    path: /var/cache/drone
    rebuild: true
    mount:
      - node_modules
```

Example configuration for ignoring creates a hash file name based on branch name:

```diff
pipeline:
  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
+   ignore_branch: true
    path: /var/cache/drone
    rebuild: true<commit_msg>update desc<commit_after>---
date: 2017-04-11T00:00:00+00:00
title: SFTP Cache
author: appleboy
tags: [ publish, ssh, sftp, cache ]
repo: appleboy/drone-sftp-cache
logo: sftp_cache.svg
image: appleboy/drone-sftp-cache
---

Use this plugin for caching build artifacts to speed up your build times. This plugin can create and restore caches of any folders.

```yaml
pipeline:
  restore_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
    path: /var/cache/drone
    restore: true
    mount:
      - node_modules

  build:
    image: node:latest
    commands:
      - npm install

  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
    path: /var/cache/drone
    rebuild: true
    mount:
      - node_modules
```

Example configuration for login with user private key:

```diff
pipeline:
  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
-   password: <PASSWORD>
+   key: plain_text_of_user_private_key
    path: /var/cache/drone
    rebuild: true
    mount:
      - node_modules
```

Example configuration for creates a hash file name only based on mount path:

```diff
pipeline:
  rebuild_cache:
    image: applebot/drone-sftp-cache
    server: example.com
    port: 22
    username: test
    password: <PASSWORD>
+   ignore_branch: true
    path: /var/cache/drone
    rebuild: true
{'fraction_non_alphanumeric': 0.09305417082087072, 'fraction_numerical': 0.017281488866733134, 'mean_word_length': 2.9295039164490864, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1875192', 'n_tokens_mistral': 1066, 'n_tokens_neox': 995, 'n_words': 290}