NorthscaleClient 未一致地设置值

发布于 2024-09-14 11:57:54 字数 613 浏览 11 评论 0原文

我正在使用 Enyim Memcached 客户端库中的 NorthscaleClient 将对象存储在 Northscale Memcached 服务器。下面的工作并不一致,断言大多数时候都会失败。我做错了什么吗?

        // File size is 360kb
        var reader = File.ReadAllText(@"c:\RHDSetup.log");
        for (int i = 0; i < 10; i++)
        {
            Assert.True(new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
                                reader));

            Thread.Sleep(1000);
        }

I am using NorthscaleClient from Enyim Memcached client libary to store objects in Northscale Memcached Server. Below does not work consistently, assertion fails most of the time. Am I doing anything wrong?

        // File size is 360kb
        var reader = File.ReadAllText(@"c:\RHDSetup.log");
        for (int i = 0; i < 10; i++)
        {
            Assert.True(new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
                                reader));

            Thread.Sleep(1000);
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凡间太子 2024-09-21 11:57:54

问题是 new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
reader) 在 Assert.True 方法中。删除内联调用并在外部初始化后效果很好。我想,有时对象可能超出范围并且断言失败。

The problem was the usage of new NorthScaleClient(c).Store(StoreMode.Set, i.ToString(),
reader)
inside Assert.True method. After removing inline call and initializing it outside works well. I guess, it is probably sometimes the object goes out of scope and assertion fails.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文