AS AgentScopeAPI 手册 / API Reference

JdbcStore

public class JdbcStore implements BaseStore
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:48–322

JDBC 存储,负责持久化与读取数据。位于 io.agentscope.extensions.jdbc.store 包,实现 BaseStore。核心成员包括 builder、get、put、putIfVersion、search、delete。

JDBC-backed BaseStore with zero inline SQL — all database-specific SQL is delegated to StoreDialect.

Supports MySQL, PostgreSQL, SQLite, and H2 via the dialect abstraction. Business logic (CAS, namespace encoding, hash-based change detection, pagination) is completely database-agnostic.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
`JdbcStore`的构建器。
Builder for `JdbcStore`.

方法摘要Method Summary

方法Method说明Description
public static Builder builder(DataSource dataSource)
static
创建构建器用于`JdbcStore`。
Creates a builder for `JdbcStore`.
public StoreItem get(List<String> namespace, String key)
按条件读取数据。
Performs the get operation.
public void put(List<String> namespace, String key, Map<String, Object> value)
执行 `put` 方法。
Performs the put operation.
public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)
执行 `putIfVersion` 方法。
Performs the put if version operation.
public List<StoreItem> search(List<String> namespace, int limit, int offset)
执行搜索相关操作。
Performs the search operation.
public void delete(List<String> namespace, String key)
删除数据。
Performs the delete operation.

方法详情Method Detail

builder

public static Builder builder(DataSource dataSource)
static

创建构建器用于JdbcStore。

Creates a builder for JdbcStore.

参数Parameters
名称Name类型Type说明Description
dataSourceDataSource数据来源(类型 `DataSource`)。The data source.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:69–71

get

public StoreItem get(List<String> namespace, String key)

按条件读取数据。

Performs the get operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
返回Returns StoreItem
返回StoreItem。Returns store item.
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:88–106

put

public void put(List<String> namespace, String key, Map<String, Object> value)

执行 put 方法。

Performs the put operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
valueMap<String, Object>值(类型 `Map`)。The value.
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:108–122

putIfVersion

public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)

执行 putIfVersion 方法。

Performs the put if version operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
valueMap<String, Object>值(类型 `Map`)。The value.
expectedVersionlongexpected 版本(类型 `long`)。The expected version.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:124–160

delete

public void delete(List<String> namespace, String key)

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
源码Source io/agentscope/extensions/jdbc/store/JdbcStore.java:188–199

嵌套类详情Nested Class Detail

Builder

public static final class Builder

JdbcStore的构建器。位于 io.agentscope.extensions.jdbc.store 包。核心成员包括 dialect、objectMapper、initializeSchema、build。

Builder for JdbcStore.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.