cache
Creates, updates, deletes, gets or lists a cache resource.
Overview
| Name | cache |
| Type | Resource |
| Id | vercel.edge_cache.cache |
Fields
The following fields are returned by SELECT queries:
SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
invalidate_by_tags | exec | projectIdOrName, tags | teamId, slug | Marks a cache tag as stale, causing cache entries associated with that tag to be revalidated in the background on the next request. |
delete_by_tags | exec | projectIdOrName, tags | teamId, slug | Marks a cache tag as deleted, causing cache entries associated with that tag to be revalidated in the foreground on the next request. Use this method with caution because one tag can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateByTag instead. |
invalidate_by_src_images | exec | projectIdOrName, srcImages | teamId, slug | Marks a source image as stale, causing its corresponding transformed images to be revalidated in the background on the next request. |
delete_by_src_images | exec | projectIdOrName, srcImages | teamId, slug | Marks a source image as deleted, causing cache entries associated with that source image to be revalidated in the foreground on the next request. Use this method with caution because one source image can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateBySrcImage instead. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
projectIdOrName | string | |
slug | string | The Team slug to perform the request on behalf of. |
teamId | string | The Team identifier to perform the request on behalf of. |
Lifecycle Methods
EXEC variables use wire (API) names.
- invalidate_by_tags
- delete_by_tags
- invalidate_by_src_images
- delete_by_src_images
Marks a cache tag as stale, causing cache entries associated with that tag to be revalidated in the background on the next request.
EXEC vercel.edge_cache.cache.invalidate_by_tags
@projectIdOrName='{{ projectIdOrName }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"tags": "{{ tags }}",
"target": "{{ target }}"
}'
;
Marks a cache tag as deleted, causing cache entries associated with that tag to be revalidated in the foreground on the next request. Use this method with caution because one tag can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateByTag instead.
EXEC vercel.edge_cache.cache.delete_by_tags
@projectIdOrName='{{ projectIdOrName }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"revalidationDeadlineSeconds": {{ revalidationDeadlineSeconds }},
"tags": "{{ tags }}",
"target": "{{ target }}"
}'
;
Marks a source image as stale, causing its corresponding transformed images to be revalidated in the background on the next request.
EXEC vercel.edge_cache.cache.invalidate_by_src_images
@projectIdOrName='{{ projectIdOrName }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"srcImages": "{{ srcImages }}"
}'
;
Marks a source image as deleted, causing cache entries associated with that source image to be revalidated in the foreground on the next request. Use this method with caution because one source image can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateBySrcImage instead.
EXEC vercel.edge_cache.cache.delete_by_src_images
@projectIdOrName='{{ projectIdOrName }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"revalidationDeadlineSeconds": {{ revalidationDeadlineSeconds }},
"srcImages": "{{ srcImages }}"
}'
;