Table of Contents

Class CachedContent

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

A resource used in LLM queries for users to explicitly specify what to cache.

public record CachedContent : IEquatable<CachedContent>
Inheritance
CachedContent
Implements
Inherited Members

Properties

CreateTime

Creation time of the cache entry.

[JsonPropertyName("createTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? CreateTime { get; set; }

Property Value

DateTime?

DisplayName

The user-generated meaningful display name of the cached content.

[JsonPropertyName("displayName")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DisplayName { get; set; }

Property Value

string

ExpireTime

Expiration time of the cached content.

[JsonPropertyName("expireTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? ExpireTime { get; set; }

Property Value

DateTime?

Model

The name of the publisher model to use for cached content.

[JsonPropertyName("model")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Model { get; set; }

Property Value

string

Name

The server-generated resource name of the cached content.

[JsonPropertyName("name")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Name { get; set; }

Property Value

string

UpdateTime

When the cache entry was last updated in UTC time.

[JsonPropertyName("updateTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? UpdateTime { get; set; }

Property Value

DateTime?

UsageMetadata

Metadata on the usage of the cached content.

[JsonPropertyName("usageMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public CachedContentUsageMetadata? UsageMetadata { get; set; }

Property Value

CachedContentUsageMetadata

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a CachedContent object.

public static CachedContent? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

CachedContent

The deserialized CachedContent object, or null if deserialization fails.