Delete context cache

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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.