Пример #1
0
        public void TrackViewModelCreatedOrUpdated(string routeName, string viewModelCacheId, int jsonLength)
        {
            if (routeName == options.RouteName)
            {
                return;
            }

            lock (viewModelEntriesLocker)
            {
                var cacheKey = new ViewModelCacheKey(routeName, viewModelCacheId);
                if (!viewModelEntries.TryGetValue(cacheKey, out var entry))
                {
                    entry = new ViewModelStatsEntry()
                    {
                        RouteName                = routeName,
                        ViewModelCacheId         = viewModelCacheId,
                        InMemoryStoreSizeInBytes = store.Retrieve(viewModelCacheId).Length,
                        JsonSizeInBytes          = jsonLength,
                        ReuseCount               = 1
                    };
                    viewModelEntries.Add(cacheKey, entry);
                }
                else
                {
                    entry.ReuseCount++;
                }
            }
        }
Пример #2
0
 public bool Equals(ViewModelCacheKey other)
 {
     return(RouteName == other.RouteName && ViewModelId == other.ViewModelId);
 }