CachesFutures

public abstract class CachesFutures 

A Java-friendly wrapper for the Caches class, providing ListenableFuture for asynchronous operations.

Summary

Public methods

abstract @ NonNull ListenableFuture <@ NonNull CachedContext >

Creates a cached context that can be used in future GenerateContentRequest s.

abstract @ NonNull ListenableFuture <@ NonNull Boolean >
delete (@ NonNull String  name)

Deletes the cached context with the given name.

static final @ NonNull CachesFutures
from (@ NonNull GenerativeModel  generativeModel)
abstract @ NonNull ListenableFuture < CachedContext >
get (@ NonNull String  name)

Returns the cached context with the given name.

abstract @ NonNull ListenableFuture <@ NonNull List <@ NonNull CachedContext >>
list ()

Queries the cached contexts created by create .

Public methods

create

public abstract @ NonNull 
 ListenableFuture 
<@ NonNull 
 CachedContext 
 create 
(@ NonNull 
 CreateCachedContextRequest 
 request)

Creates a cached context that can be used in future GenerateContentRequest s.

delete

public abstract @ NonNull 
 ListenableFuture 
<@ NonNull 
 Boolean 
 delete 
(@ NonNull 
 String 
 name)

Deletes the cached context with the given name.

from

public static final @ NonNull 
 CachesFutures 
 from 
(@ NonNull 
 GenerativeModel 
 generativeModel)
Parameters
@ NonNull GenerativeModel  generativeModel

the GenerativeModel instance that contains the Caches instance.

Returns
@ NonNull CachesFutures

a CachesFutures created from the provided GenerativeModel instance.

get

public abstract @ NonNull 
 ListenableFuture 
< CachedContext 
 get 
(@ NonNull 
 String 
 name)

Returns the cached context with the given name.

list

public abstract @ NonNull 
 ListenableFuture 
<@ NonNull 
 List 
<@ NonNull 
 CachedContext 
>>  list 
()

Queries the cached contexts created by create .

Design a Mobile Site
View Site in Mobile | Classic
Share by: