/// <summary> /// Gets the or add cache. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public ICache?GetOrAddCache(string name = "Default") { if (Caches is null) { return(null); } var CacheKey = GetKey(name); if (Caches.TryGetValue(CacheKey, out var ReturnValue)) { return(ReturnValue); } lock (CacheCreationLock) { if (Caches.TryGetValue(CacheKey, out ReturnValue)) { return(ReturnValue); } var DefaultKey = GetKey("Default"); Caches.TryGetValue(DefaultKey, out ReturnValue); ReturnValue = ReturnValue.Clone(); if (ReturnValue is null) { return(null); } Caches.Add(CacheKey, ReturnValue); return(ReturnValue); } }
public override AstStatement Clone() => CopyValuesTo(new AstReturnStmt(ReturnValue?.Clone()));
public override Expression VisitReturnValue(ReturnValue retval) { if (retval == null) return null; ReturnValue dup = (ReturnValue)this.DuplicateFor[retval.UniqueKey]; if (dup != null) return dup; this.DuplicateFor[retval.UniqueKey] = dup = (ReturnValue)retval.Clone(); return base.VisitReturnValue(dup); }