public void Add(ICacheableModel model) { Type type = model.GetType(); var reference = new WeakReference(model); while (!type.Equals(model.GetBaseType())) { try { var key = new ModelIdentifier(type, model.ModelId); if (this.ContainsKey(key)) { Replace(key, reference); } else { Add(key, reference); } type = type.BaseType; } catch (Exception e) { throw new AddModelDictionaryItemException(type, model.ModelId, e); } } }
public DictionaryModelCache(ICacheableModel model) : base(model) { cache = new Dictionary <long, T> (model.FetchCount); }
public ArrayModelCache(ICacheableModel model) : base(model) { cache = new T [Model.FetchCount]; }
public ModelCache(ICacheableModel model) { Model = model; }
public async Task <ICacheableModel> UpdateModelAsync(ICacheableModel model) { return(await updateFuncAsync(model)); }
public ModelCache(ICacheableModel model) { this.model = model; }
public int GetHashCode(ICacheableModel obj) { throw new NotImplementedException(); }
public ModelIdentifier(ICacheableModel model) { ModelType = model.GetType(); ModelId = model.ModelId; }