Skip to main content

Set up a kmpkg asset cache

All asset caches are configured through the X_KMPKG_ASSET_SOURCES environment variable. The value of X_KMPKG_ASSET_SOURCES follows a specific configuration syntax.

In this tutorial you'll learn how to:

Prerequisites

  • A terminal
  • kmpkg

1 - Create an asset cache directory

kmpkg offers the following asset cache providers:

  • x-azurl: which is intended to work with Azure Blob Storage containers, but works just as well with other service providers and even local or network filesystems.
  • x-script: which lets you add your own business logic to handle asset caching through a customizable script or executable.

This tutorial uses, x-azurl as the provider to store assets in a local directory in your filesystem using a URL with the file:// protocol.

info

You can use these same steps to create an asset cache with Azure Blob Storage. Replace any URL in the tutorial with the URL for your storage and provide a SAS Token for authentication.

  1. Create a directory to serve as an asset cache location (substitute with any locations of your choosing):
mkdir Z:\kmpkg\asset-cache

2 - Configure X_KMPKG_ASSET_SOURCES

Next set the value of X_KMPKG_ASSET_SOURCES as follows:

$env:X_KMPKG_ASSET_SOURCES="clear;x-azurl,file:///Z:/kmpkg/asset-cache,,readwrite"

Setting environment variables in this manner only affects the current terminal session. To make these changes permanent across all sessions, set them through the Windows System Environment Variables panel.

Next steps

Here are other tasks to try next: