public T Get <T>(ICacheIdentifier cacheIdentifier)
        {
            // Get the cached element.
            var element = Cache.Get(cacheIdentifier);

            element.AddWatcher(this);

            // Add the element to the savedElements and currentCycle.
            _savedElements.Add(element);
            _currentCycle.Add(element);

            return((T)element.Value);
        }
        public static CacheElement Get(ICacheIdentifier cacheIdentifier)
        {
            // Get the cached value from the identifier.
            foreach (var element in _cacheElements)
            {
                if (element.Identifier.Matches(cacheIdentifier))
                {
                    return(element);
                }
            }

            // If the cached value does not exist, create it.
            var newElement = new CacheElement(cacheIdentifier);

            _cacheElements.Add(newElement);
            return(newElement);
        }
 public bool Matches(ICacheIdentifier other) => other is CompressedBakeCacheObject pathmapCacheObject &&
Exemple #4
0
 public bool Matches(ICacheIdentifier other) => other is FileIdentifier <T> fileIdentifier && _uri.Compare(fileIdentifier._uri);
 public CacheElement(ICacheIdentifier identifier)
 {
     Identifier = identifier;
     Value      = identifier.GetValue();
 }