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.
-
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
- ACreateCachedContentConfig
for configuring the create request.- Returns:
- A
CachedContent
object 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
- AGetCachedContentConfig
for configuring the get request.- Returns:
- A
CachedContent
object 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
- ADeleteCachedContentConfig
for configuring the delete request.
-
list
Asynchronously makes an API request to list the available cached contents.- Parameters:
config
- AListCachedContentsConfig
for 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.
-