Esempio n. 1
0
        public virtual async Task <T> GetAsync(string id)
        {
            var primaryCacheKey = PrimaryCacheKeyFormatter(id);
            var response        = await _appCache.GetValueAsync <T>(primaryCacheKey, PartitionNameFormatter()).ConfigureAwait(false);

            return(response);
        }
Esempio n. 2
0
        public void ShouldSaveItemsIntoPartition()
        {
            // Arrange
            foreach (var userInfo in _users)
            {
                _appCache.AddOrUpdateAsync(userInfo.EntityId.ToString(), userInfo, null, "Users").WaitAndUnwrapException();
            }

            // Act
            var user1    = _appCache.GetValueAsync <UserInfo>(_users[0].EntityId.ToString(), "Users").WaitAndUnwrapException();
            var allUsers = _appCache.GetAllItemsInPartitionAsync <UserInfo>("Users").WaitAndUnwrapException();

            // Assert
            Assert.IsNotNull(user1);
            Assert.AreEqual(user1.EntityId, _users[0].EntityId);
            Assert.AreEqual(allUsers.Count, _users.Count);
        }