/// <summary> /// Adds the stecified item in the cache. /// </summary> /// <param name="id">The id of the stored item in the cache.</param> /// <param name="item">The item to cache.</param> protected void AddInCache(Identifier id, T item) { if (!InternalCache.ContainsKey(id)) { InternalCache.Add(id, item); } }
/// <summary> /// Adds an item to the cache /// </summary> /// <param name="Key">Key</param> /// <param name="Value">Value</param> public virtual void Add(KeyType Key, object Value) { lock (InternalCache) { if (Exists(Key)) { InternalCache[Key].Value = Value; } else { InternalCache.Add(Key, new CacheItem <KeyType>(Key, Value)); } } }
protected override AppointmentDto Map(SQLiteDataReader reader) { var rid = reader["Id"] as long?; Identifier id; if (!rid.HasValue) { throw new NullReferenceException("There's an appointment without ID"); } else { id = new Identifier(rid.Value); } if (InternalCache.ContainsKey(id)) { return(InternalCache[id]); } else { var item = new AppointmentDto() { IsImported = true }; item.StartTime = reader["StartDate"] as DateTime? ?? DateTime.Now; item.EndTime = reader["EndDate"] as DateTime? ?? DateTime.Now; item.Subject = reader["Title"] as string; item.Notes = Messages.Msg_DoneByConverter; item.User = PluginContext.Host.ConnectedUser; item.Tag = this.MapTag(reader["fk_MeetingType"] as long?); InternalCache.Add(id, item); return(item); } }
/// <inheritdoc /> public void Add(TMajor item) => InternalCache.Add(item);
/// <inheritdoc /> public void Add(TMajor record) => InternalCache.Add(record);