private string GetKeyForCurrentUser(string cacheName)
 {
     return(_cachedUniqueKeyPerUser.GetKey(cacheName, AbpSession.TenantId, AbpSession.UserId));
 }
Exemplo n.º 2
0
        public void Should_Get_Same_Key_Until_Cache_Expire()
        {
            var cachedKey  = _cachedUniqueKeyPerUser.GetKey(MyTestCacheName);
            var cachedKey2 = _cachedUniqueKeyPerUser.GetKey(MyTestCacheName);

            cachedKey2.ShouldBe(cachedKey);

            Thread.Sleep(TimeSpan.FromSeconds(6));

            var cachedKey3 = _cachedUniqueKeyPerUser.GetKey(MyTestCacheName);

            cachedKey3.ShouldNotBe(cachedKey);
            var cachedKey4 = _cachedUniqueKeyPerUser.GetKey(MyTestCacheName);

            cachedKey4.ShouldBe(cachedKey3);
        }