我是 Aerospike DB 的新手,希望尝试事务性。
我们有一个 API,可以在单个请求中更新 TableA 和 TableB。 现在,如何使我的请求具有事务性并实现原子性?
Aerospike 本身尚不支持多记录交易。
有一个非官方的方法可以实现多记录交易:
https://aerospike.com/blog/multi-record-transactions-for-aerospike/
https://github.com/aerospike-examples/atomicMultiRecordTxn
但它有缺陷(https://github.com/aerospike-examples/atomicMultiRecordTxn#caveats)并且 Spring Data Aerospike 不支持它 - 您添加了
spring-boot
标签,所以我假设您正在使用 Spring Data Aerospike。
另一种方法可能涉及对数据进行不同的建模,从而可能消除对多记录事务的需求。 Aerospike 支持丰富的数据模型,其中包括地图和列表,请查看:https://docs.aerospike.com/server/guide/data-types/overview