コード例 #1
0
        public async Task LeftPushAndFixLength()
        {
            var list = new RedisList<int>(GlobalSettings.Default, "listkey3");
            await list.Delete();

            await list.LeftPush(new[] { 1, 2, 3, 4, 5 });
            await list.LeftPush(new[] { 6, 7, 8, 9, 10 });

            (await list.Range()).Is(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
            await list.LeftPushAndFixLength(100, 10);
            (await list.Range()).Is(100, 10, 9, 8, 7, 6, 5, 4, 3, 2);
            await list.LeftPushAndFixLength(1000, 3);
            (await list.Range()).Is(1000, 100, 10);
        }
コード例 #2
0
        public async Task LeftPushAndFixLength()
        {
            var list = new RedisList <int>(GlobalSettings.Default, "listkey3");
            await list.Delete();

            await list.LeftPush(new[] { 1, 2, 3, 4, 5 });

            await list.LeftPush(new[] { 6, 7, 8, 9, 10 });

            (await list.Range()).Is(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
            await list.LeftPushAndFixLength(100, 10);

            (await list.Range()).Is(100, 10, 9, 8, 7, 6, 5, 4, 3, 2);
            await list.LeftPushAndFixLength(1000, 3);

            (await list.Range()).Is(1000, 100, 10);
        }