Delete context cache
Stay organized with collections
Save and categorize content based on your preferences.
Delete a specific context cache that's no longer used.
Code sample
C#
Before trying this sample, follow the C# setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI C# API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
usingGoogle.Cloud.AIPlatform.V1Beta1 ;
usingSystem;
usingSystem.Threading.Tasks;
publicclassDeleteContextCache
{
publicasyncTaskDelete(CachedContentName name)
{
varclient=awaitnewGenAiCacheServiceClientBuilder
{
Endpoint="us-central1-aiplatform.googleapis.com"
}.BuildAsync();
awaitclient.DeleteCachedContentAsync(name);
Console.WriteLine($"Deleted cache: {name}");
}
}
What's next
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.