不知道是否是对问题的最佳标题...也许有人可以给我改名?
我的问题是关于读取性能和数据在C#ServiceStack包装为Redis的组合和内部调用的工作方式。
我来解释一下两种方案,将在最终结果有望产生。 一种情况具有安装,这样的分类可以独立存于交易类ID的列表。
问 :我的最终目标是要检索具有类别“食物”的所有交易。
我曾尝试一些其他的点,其中透明度将有助于我的理解。 认为有是10,000个事务,平均3个类别每次交易了。
注意:在一个相关的问题ServiceStack.Net Redis的:存储与对象相关与IDS的对象但是没有解释的效率。
示例A
public class Transaction
{
public List<string> CategoryIds;
}
实施例B
public class Transaction
{
public List<string> CategoryNames;
}
码
var transactionClient = redisClient.GetTypedClient<Transaction>();
//1. is this inefficient returning all transactions?
// is there any filtering available at this part?
var allTransactions = transactionClient.GetAll();
//2. In the case of Example A where the categories are stored as id's
// how would I map the categories to a transaction?
// maybe I have a List that has a container with the Transaction associated with a
// list of Categories, however this seems inefficient as I would have to loop
// through all transactions make a call to get their Categories and then
// populate the container datatype.
//3. If we are taking Example B how can I efficiently just retrieve the transactions
// where they have a category of food.