Exemplo n.º 1
0
 /// <summary>
 /// Clears the internal Engine caches.
 /// </summary>
 public static void ClearCache()
 {
     CacheInvalidator.InvalidateCaches(ClrProvider);
     UserTypeMetadataCaches.InvalidateCache();
     GlobalCache.Processes.Clear();
     GlobalCache.Caches.InvalidateCache();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Clears the internal Engine caches.
 /// </summary>
 public static void ClearCache()
 {
     CacheInvalidator.InvalidateCaches(ClrProvider);
     GlobalCache.Processes.Clear();
     GlobalCache.UserTypeCastedVariableCollections.Clear();
     GlobalCache.UserTypeCastedVariables.Clear();
     GlobalCache.VariablesUserTypeCastedFields.Clear();
     GlobalCache.VariablesUserTypeCastedFieldsByName.Clear();
 }
Exemplo n.º 3
0
        public void InvalidateStruct()
        {
            DifferentCachesStruct differentCaches = new DifferentCachesStruct(false);

            Assert.False(differentCaches.simpleCache.Cached);
            Assert.False(differentCaches.simpleCacheStruct.Cached);
            Assert.Equal(42, differentCaches.SimpleCacheValue);
            Assert.Equal(42, differentCaches.SimpleCacheStructValue);
            Assert.True(differentCaches.simpleCache.Cached);
            Assert.True(differentCaches.simpleCacheStruct.Cached);
            CacheInvalidator.InvalidateCaches(ref differentCaches);
            Assert.False(differentCaches.simpleCache.Cached);
            Assert.False(differentCaches.simpleCacheStruct.Cached);
        }
Exemplo n.º 4
0
        public void InvalidateCaches()
        {
            DictionaryCache <int, string> dictionaryCache;
            SimpleCache <int>             simpleCache;
            CacheTestClass test = new CacheTestClass();

            test.CacheInvalidator = new CacheInvalidator();
            dictionaryCache       = test.CacheInvalidator.CreateDictionaryCache <int, string>(key => key.ToString());
            simpleCache           = test.CacheInvalidator.CreateSimpleCache(() => 42);
            dictionaryCache.TryGetValue(simpleCache.Value, out string testValue);
            CacheInvalidator.InvalidateCaches(test);
            CacheInvalidator.InvalidateCaches <CacheTestClass>(null);
            CacheInvalidator.InvalidateCaches(new CacheTestClass());
            Assert.Equal(0, dictionaryCache.Count);
            Assert.False(simpleCache.Cached);
        }
Exemplo n.º 5
0
        public void InvalidateObject()
        {
            DifferentCaches differentCaches = new DifferentCaches();

            Assert.False(differentCaches.simpleCache.Cached);
            Assert.False(differentCaches.simpleCacheStruct.Cached);
            Assert.False(differentCaches.simpleCacheWithContext.Cached);
            Assert.Equal(42, differentCaches.SimpleCacheValue);
            Assert.Equal(42, differentCaches.SimpleCacheStructValue);
            Assert.Equal(42, differentCaches.SimpleCacheWithContextValue);
            Assert.True(differentCaches.simpleCache.Cached);
            Assert.True(differentCaches.simpleCacheStruct.Cached);
            Assert.True(differentCaches.simpleCacheWithContext.Cached);
            CacheInvalidator.InvalidateCaches(differentCaches);
            Assert.False(differentCaches.simpleCache.Cached);
            Assert.False(differentCaches.simpleCacheStruct.Cached);
            Assert.False(differentCaches.simpleCacheWithContext.Cached);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Invalidates cache structures.
 /// Use when memory state changes (e.g. during live debugging).
 /// </summary>
 public void InvalidateProcessCache()
 {
     CacheInvalidator.InvalidateCaches(this);
 }