当前位置: 首页>>代码示例>>C#>>正文


C# RedisConnection.Remove方法代码示例

本文整理汇总了C#中BookSleeve.RedisConnection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# RedisConnection.Remove方法的具体用法?C# RedisConnection.Remove怎么用?C# RedisConnection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BookSleeve.RedisConnection的用法示例。


在下文中一共展示了RedisConnection.Remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncRedisUsage

        // could also be void; only a Task here so I can Wait on
        // completion from my Main method, which is not declared
        // as async
        async static Task AsyncRedisUsage()
        {
            const int db = 4; // no reason

            using(var conn = new RedisConnection("127.0.0.1"))
            {
                // let's wait until all handshakes have happened
                await conn.Open();
                var existed = conn.Remove(db, "some-key");
                for (int i = 0; i < 100; i++)
                {   // this are also tasks, but I don't
                    // need to wait on them in this case
                    conn.Increment(db, "some-key");
                }
                // at this point, some messages are flying around
                // from a background queue, with responses being
                // handled by IOCP; let's add a GET onto the
                // bottom of the queue, and let other stuff
                // happen until we have the answer (obviously
                // we could make much more subtle use here, by
                // awaiting multiple things requested much earlier,
                // or by doing some SQL Server work etc before
                // calling await, essentially acting as a "join")
                string result = await conn.GetString(db, "some-key");
                Console.WriteLine(await existed
                    ? "(it already existed; we removed it)"
                    : "(it didn't exist)");
                Console.WriteLine(result);
            }
        }
开发者ID:rhagigi,项目名称:Booksleeve,代码行数:33,代码来源:Program.cs


注:本文中的BookSleeve.RedisConnection.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。