Package com.google.genai
Class Caches
java.lang.Object
com.google.genai.Caches
Provides methods for managing the cached content. Instantiating this class is not required. After
instantiating a
Client, access methods through `client.caches.methodName(...)` directly.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(String model, CreateCachedContentConfig config) Creates a cached content resource.delete(String name, DeleteCachedContentConfig config) Deletes a cached content resource.get(String name, GetCachedContentConfig config) Gets a cached content resource.list(ListCachedContentsConfig config) Makes an API request to list the available cached contents.update(String name, UpdateCachedContentConfig config) Updates a cached content resource.
-
Constructor Details
-
Caches
public Caches(com.google.genai.ApiClient apiClient)
-
-
Method Details
-
create
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
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
Deletes a cached content resource.- Parameters:
name- The name(resource id) of the cached content to delete.config- ADeleteCachedContentConfigfor configuring the delete request.
-
update
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
Makes an API request to list the available cached contents.- Parameters:
config- AListCachedContentsConfigfor configuring the list request.- Returns:
- A
Pagerobject that contains the list of cached contents. The pager is an iterable and automatically queries the next page once the current page is exhausted.
-