Package com.google.genai
Class AsyncCaches
java.lang.Object
com.google.genai.AsyncCaches
Async module of
Caches-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(String model, CreateCachedContentConfig config) Asynchronously creates a cached content resource.delete(String name, DeleteCachedContentConfig config) Asynchronously deletes a cached content resource.get(String name, GetCachedContentConfig config) Asynchronously gets a cached content resource.list(ListCachedContentsConfig config) Asynchronously makes an API request to list the available cached contents.update(String name, UpdateCachedContentConfig config) Asynchronously updates a cached content resource.
-
Constructor Details
-
AsyncCaches
public AsyncCaches(com.google.genai.ApiClient apiClient)
-
-
Method Details
-
create
Asynchronously creates a cached content resource.- Parameters:
model- The model to use.config- ACreateCachedContentConfigfor configuring the create request.- Returns:
- A
CachedContentobject that contains the info of the created resource.
-
get
Asynchronously gets a cached content resource.- Parameters:
name- The name(resource id) of the cached content to get.config- AGetCachedContentConfigfor configuring the get request.- Returns:
- A
CachedContentobject that contains the info of the cached content.
-
delete
public CompletableFuture<DeleteCachedContentResponse> delete(String name, DeleteCachedContentConfig config) Asynchronously deletes a cached content resource.- Parameters:
name- The name(resource id) of the cached content to delete.config- ADeleteCachedContentConfigfor configuring the delete request.
-
update
Asynchronously updates a cached content resource.- Parameters:
name- The name(resource id) of the cached content to update.config- AUpdateCachedContentConfigfor configuring the update request.- Returns:
- A
CachedContentobject that contains the info of the updated resource.
-
list
Asynchronously makes an API request to list the available cached contents.- Parameters:
config- AListCachedContentsConfigfor configuring the list request.- Returns:
- A CompletableFuture that resolves to a
AsyncPager. The AsyncPager has a `forEach` method that can be used to asynchronously process items in the page and automatically query the next page once the current page is exhausted.
-