gpt4 book ai didi

c# - 我可以使用 Cassandra 来存储对象吗?

转载 作者:行者123 更新时间:2023-11-30 17:22:20 25 4
gpt4 key购买 nike

我的应用程序是这样工作的。

有命令的数据库(Mysql)。该命令是一个对象(由许多字段组成,例如整数和字符串)。有一个与数据库交互并从数据库获取命令并执行一些操作的网络服务。

我将命令存储到数据库中的方式是剥离所有字段并将它们插入到数据库中。

我可以使用 cassandra 代替 mysql 并存储命令对象吗?

最佳答案

您为什么要放弃当前涉及关系数据库的解决方案?我不会(信不信由你)建议过早更改您的数据存储。

如果您遇到问题并想更换关系数据库,那么我建议您调查一下 Apache Cassandra .

如果您觉得 Cassandra 很有趣,我建议您使用如下所示的数据模型:

Commands = { // this is a ColumnFamily (CF)
commandObject1: { // this is the key to this Row inside the CF
// now we have an infinite # of columns in this row
field1: "value1",
field2: "value2",
field3: "value3"
}, // end row
commandObject2: { // this is the key to another row in the CF
// now we have another infinite # of columns in this row
field1: "value1",
field2: "value2",
field3: "value3"
field4: "value4",
field5: "value5"
},
}

(感谢 Arin(以及他出色的 blog post )提供的 Cassandra 数据模型符号)

关于c# - 我可以使用 Cassandra 来存储对象吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2768289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com