コード例 #1
0
ファイル: HashTests.cs プロジェクト: AndMu/Wikiled.Redis
        public async Task KeyValue(bool isSet)
        {
            Redis.PersistencyRegistration.RegisterHashSet <Identity>();
            Key.AddIndex(new IndexKey("Data", isSet));
            await Redis.Client.AddRecord(Key, Routing).ConfigureAwait(false);

            var result = await Redis.Client.GetRecords <Identity>(Key).FirstAsync();

            Assert.AreEqual("Test", result.ApplicationId);
            Assert.AreEqual("DEV", result.Environment);
        }
コード例 #2
0
        public async Task Transaction()
        {
            Key.AddIndex(ListAll);
            var transaction = Redis.StartTransaction();
            var task1       = transaction.Client.AddRecord(Key, "Test");
            var rawResult   = await Redis.Client.GetRecords <string>(Key).LastOrDefaultAsync();

            Assert.IsNull(rawResult);
            await transaction.Commit().ConfigureAwait(false);

            await task1.ConfigureAwait(false);

            rawResult = await Redis.Client.GetRecords <string>(Key).LastOrDefaultAsync();

            Assert.AreEqual("Test", rawResult);
        }