protected override async Task <RenrenAyncRespArgs <AlbumListEntity> > DoOfflineDataRequest(params object[] args) { int uid = (int)args[0]; int page = (int)args[1]; int pageSize = (int)args[2]; // TODO: // 创建相应的缓存片段 // 查看缓存是否有效 // 进行缓存逻辑 var hashKey = generateHashKey(uid, page, pageSize); DateTime expTime = DateTime.Now.AddDays(ExpirationTimeDay); ICacheChip <AlbumListEntity> chip = _cacheImpl.CreateCacheChip(hashKey, expTime); var valid = _cacheImpl.IsValid(chip); if (valid && !this.ForceDataRequest) { AlbumListEntity content = await _cacheImpl.Pick(chip); return(new RenrenAyncRespArgs <AlbumListEntity>(content)); } else { var resp = await Renren3GApiWrapper.GetAlbumList(this.LoginInfo.LoginInfo.Session_key, this.LoginInfo.LoginInfo.Secret_key, uid, page, pageSize); if (resp.Result != null) { await _cacheImpl.Add(chip, resp.Result); } return(resp); } }
protected override Task <RenrenAyncRespArgs <AlbumListEntity> > DoRequest(params object[] args) { int uid = (int)args[0]; int page = (int)args[1]; int pageSize = (int)args[2]; // TODO: download the data and return through 3g api var resp = Renren3GApiWrapper.GetAlbumList(this.LoginInfo.LoginInfo.Session_key, this.LoginInfo.LoginInfo.Secret_key, uid, page, pageSize); return(resp); }