Package com.google.genkit.ai.session
Interface SessionStore<S>
- Type Parameters:
S- the type of the custom session state
- All Known Implementing Classes:
InMemorySessionStore
public interface SessionStore<S>
SessionStore is an interface for persisting session data.
Implementations can provide different storage backends such as:
- In-memory storage (for development/testing)
- Database storage (for production)
- Redis or other distributed cache
- File-based storage
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Void> Deletes a session by its ID.default CompletableFuture<Boolean> Checks if a session exists.Retrieves a session by its ID.save(String sessionId, SessionData<S> data) Saves session data.
-
Method Details
-
get
Retrieves a session by its ID.- Parameters:
sessionId- the session ID- Returns:
- a CompletableFuture containing the session data, or null if not found
-
save
Saves session data.- Parameters:
sessionId- the session IDdata- the session data to save- Returns:
- a CompletableFuture that completes when the save is done
-
delete
Deletes a session by its ID.- Parameters:
sessionId- the session ID- Returns:
- a CompletableFuture that completes when the deletion is done
-
exists
Checks if a session exists.- Parameters:
sessionId- the session ID- Returns:
- a CompletableFuture containing true if the session exists
-