12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using WingServerCommon.Interfaces.OpLog;
- namespace WingServerCommon.Interfaces.Cache
- {
- public interface ICacheManager
- {
- // <summary>
- /// Remove many cache record with specified document ids
- /// </summary>
- /// <param name="args">The db collection document uopdate or deletes args</param>
- void RemoveMany(CollectionDocumentChangedArgs args);
- }
- public interface IBaseCacheManager<T> : ICacheManager where T : ICacheObject
- {
- /// <summary>
- /// Register functions
- /// </summary>
- /// <param name="loadCacheFromDbWithId"></param>
- /// <param name="loadCachesFromDbWithIds"></param>
- void RegisterDBFunction(Func<string, T> loadCacheFromDbWithId, Func<IList<string>, IList<T>> loadCachesFromDbWithIds);
- /// <summary>
- /// Load cache from db objects
- /// </summary>
- /// <param name="cacheObjs">the cache object list</param>
- void LoadFromDbOject(IList<T> cacheObjs);
- /// <summary>
- /// Remove a cache record with specified document id
- /// </summary>
- /// <param name="documentId">The db collection document id</param>
- void Remove(string documentId);
- /// <summary>
- /// Add a cache object to cache manager
- /// </summary>
- /// <param name="cacheObj">A new cache object</param>
- void Add(T cacheObj);
- /// <summary>
- /// Get cache with specified document id
- /// </summary>
- /// <param name="documentId">the document id, the code in db</param>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- T Get(string documentId);
- /// <summary>
- /// Find values whith filters
- /// </summary>
- /// <param name="predicate"></param>
- /// <returns></returns>
- IList<T> Where(Func<T, bool> predicate);
- }
- public interface ICacheObject
- {
- /// <summary>
- /// The unique id for on record , the code in db actually
- /// </summary>
- /// <value></value>
- string Code { get; set; }
- }
- }
|