Deleting Runtime Caches

Problem

You want to request the removal of a specified runtime cache.

Solution

You must specify the language, version, and image name for the runtime cache you wish to delete. See Viewing Runtime Caches to view runtime caches on your Connect server.

from posit import connect

LANGUAGE = "Python"
VERSION = "3.12.0"
IMAGE_NAME = "Local"

client = connect.Client()

task = client.system.caches.runtime.destroy(
  language = LANGUAGE,
  version = VERSION,
  image_name = IMAGE_NAME,
)

# Wait for cache deletion to complete
task.wait_for()

# Confirm runtime caches
caches = client.system.caches.runtime.find()
Note

This functionality requires connectapi version 0.4.0 or later.

You must specify the language, version, and image name for the runtime cache you wish to delete. See Viewing Runtime Caches to view runtime caches on your Connect server.

library(connectapi)

LANGUAGE <- "R"
VERSION <- "4.3.0"
IMAGE_NAME <- "Local"

client <- connect()

client <- connect()

task <- delete_runtime_cache(
  client,
  language = LANGUAGE,
  version = VERSION,
  image_name = IMAGE_NAME
)

Runtime cache deletion can take some time. A successful request indicates that deletion was started, and returns a task object. You can use the poll_task() function to check the status of the deletion.

> poll_task(task)
Deleting runtime cache...
Successfully deleted runtime cache
Posit Connect Task:
  Task ID: ER6i7P1B664bt4KW