本文介绍了缓存对象排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好,我正在尝试了解当我请求标记对象的子集时缓存如何对对象进行排序。例如,我将输入5个对象(1,2,3,4,5),每个对象由GUID键入并具有唯一标记(例如,"A")。然后,每次我用"A"调用GetObjectsByAllTags时,和相应的区域名称,它们一致地返回为5,4,1,3,2。有没有解释这种排序是如何发生的,有没有人建议如何保持我的订单的一致性? 谢谢!解决方案 您好,我正在尝试了解当我请求标记对象的子集时缓存是如何排序对象的。例如,我将输入5个对象(1,2,3,4,5),每个对象由GUID键入并具有唯一标记(例如,"A")。然后,每次我用"A"调用GetObjectsByAllTags时,和相应的区域名称,它们一致地返回为5,4,1,3,2。有没有解释这种排序是如何发生的,有没有人建议如何保持我的订单的一致性? 谢谢! 您好,我不确定我们总能依赖于返回对象的顺序。我的建议是在客户端使用Linq-to-Objects(并在GetObjectsByAllTags调用之后)获得有序清单。 HTH 安德里亚 Hello,I am trying to understand how the cache is ordering the objects when I request a subset of tagged objects. For example, I will enter 5 objects (1,2,3,4,5) each keyed by a GUID and with a unique tag (say, "A"). Then, every time I call GetObjectsByAllTags with "A" and the appropriate region name, they come back as 5,4,1,3,2 consistently. Is there any explanation to how this ordering is happening and does anyone have suggestions on how I can maintain consistency in my ordering?Thanks! 解决方案 Hello, I am trying to understand how the cache is ordering the objects when I request a subset of tagged objects. For example, I will enter 5 objects (1,2,3,4,5) each keyed by a GUID and with a unique tag (say, "A"). Then, every time I call GetObjectsByAllTags with "A" and the appropriate region name, they come back as 5,4,1,3,2 consistently. Is there any explanation to how this ordering is happening and does anyone have suggestions on how I can maintain consistency in my ordering? Thanks! Hi, I'm not sure that we can always rely on the order in which objects are returned. My suggestion is to use Linq-to-Objects, on the client side (and after GetObjectsByAllTags call) to obtain an ordered list. HTH Andrea 这篇关于缓存对象排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-10 21:01