Webtask cache

When you need to clean up the cache

How does webtask cache work?

Webtask runtime maintains in-memory cache of some webtask atrifacts that are normally durably persisted. This allows the runtime to reduce the latency of execution for frequently running webtasks. A good example of data that is cached is the compiled form of the webtask code itself. First execution of a given webtask requires the code to be fetched from the durable storage, but once that code is compiled into a JavaScript function, the function is cached in memory to speed up future invocations.

Webtask runtime takes care of purging the caches in certain situations to provide good developer experience. For example, when you update the code of a webtask, the previously compiled, cached versions of it are purged from the system. However, you can also explicitly request webtask cache to be purged using the HTTP APIs below.

NOTE historically one could add the webtask_no_cache=1 URL query parameter to the webtask URL to indicate that cached information must not be used in the execution of that webtask. This flag has been deprecated and you should avoid using it to achieve better webtask execution performance.

Deleting data from the cache

To delete cached information of all webtasks associated with a specific webtask container, use this HTTP API:

HTTPS DELETE /api/cache/{webtask_container}

To delete cached data of a single webtask, use this HTTP API:

HTTPS DELETE /api/cache/{webtask_container}/{webtask_name}

The request must be authenticated by specifying the A1 webtask token as the key URL query parameter or with the Authorization HTTP request header as described above.

Either API returns a response status code as follows:


Cache has been successfuly cleaned up and some artifacts were removed in the process.


Cache did not contain any artifacts to be removed.

4xx or 5xx

There was a problem with the request and the response body contains more information.