bool IsCacheValid(ClassDefineMetadata metadata, IQueryTimestamp cacheData) { ICache dependCache = RepositoryFramework.GetCacher(metadata, "cache:region"); var values = dependCache.GetBatch <long>(regions.Select(o => o.CacheKey)); return(values.Count() == 0 || values.All(o => o < cacheData.Timestamp)); }
public override void ProcessCache(IQueryTimestamp cacheData) { var cd = (PagingCacheData)cacheData; IRepository <TEntity> repository = (IRepository <TEntity>)Invocation.InvocationTarget; var ids = cd.CastIds(DefineMetadata.IdMember.PropertyType); Invocation.ReturnValue = new PagingResult <TEntity>(cd.TotalCount, repository.GetList(cd.ShardParams, ids)); }
public override void ProcessCache(IQueryTimestamp cacheData) { var cd = (ListCacheData)cacheData; IRepository <TEntity> repository = (IRepository <TEntity>)Invocation.InvocationTarget; var ids = cd.CastIds(DefineMetadata.IdMember.PropertyType); var m = ids.GetEnumerator(); m.MoveNext(); Invocation.ReturnValue = repository.Get(cd.ShardParams, m.Current); }
bool CheckEntity(TKey key, IQueryTimestamp data) { if (data == null) { return(true); } var cdd = new CacheDependDefine(); dependAction(cdd, key); var keys = cdd.GetCacheKey(); ICache dependCache = RepositoryFramework.GetCacherForCacheRegion(); var values = dependCache.GetBatch <long>(keys); var isValid = values.Count() == 0 || values.All(o => o < data.Timestamp); if (!isValid) { RemoveCache(key); } return(isValid); }
public override void ProcessCache(IQueryTimestamp cacheData) { var cd = (QueryCacheData)cacheData; Invocation.ReturnValue = cd.Data; }
public abstract void ProcessCache(IQueryTimestamp cacheData);