public async Task HandleScheduleCompletedEvent(ScheduleCompletedEvent e)
        {
            var schedule = await _repository.FindByUUID <Schedule>(e.ScheduleUuid).FirstOrDefaultAsync();

            if (schedule == null)
            {
                return;
            }

            var user = await _uCenter.GetUser(x => x.UserId, schedule.UserId);

            if (user == null)
            {
                return;
            }

            await _feedSvc.PublishAsync(new FeedInputModel
            {
                AppId     = AppConst.AppGuid,
                FeedType  = FeedType.ScheduleCompleted,
                ContentId = schedule.Id.ToString(),
                UserId    = schedule.UserId,
                FeedTitle = schedule.Title,
                IsPrivate = schedule.IsPrivate,
                Link      = $"{AppConst.DomainAddress}/schedules/u/{user.Alias}/{schedule.Id}"
            });

            await _cache.RemoveAsync(CacheKeyStore.HomeFeeds());
        }
        public async Task HandleScheduleItemCompletedEvent(Domain.Schedules.Events.ScheduleItemCompletedEvent e)
        {
            var item = await _repository.FindByUUID <ScheduleItem>(e.ItemUuid)
                       .Include(x => x.Schedule)
                       .Include(x => x.Html)
                       .FirstOrDefaultAsync();

            if (item == null)
            {
                return;
            }

            var subscriber = await _uCenter.GetUser(x => x.UserId, item.UserId);

            if (subscriber == null)
            {
                return;
            }

            await _feedSvc.PublishAsync(new FeedInputModel
            {
                ContentId   = item.Id.ToString(),
                FeedTitle   = item.GenerateDescription(),
                FeedContent = item.Schedule.Title,
                Link        = $"{AppConst.DomainAddress}/schedules/u/{subscriber.Alias}/{item.ScheduleId}/detail/{item.Id}",
                UserId      = item.UserId,
                AppId       = AppConst.AppGuid,
                FeedType    = FeedType.ScheduleItemDone,
                IsPrivate   = item.Schedule.IsPrivate
            });

            await _cache.RemoveAsync(CacheKeyStore.HomeFeeds());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 移除缓存,根据缓存键
        /// </summary>
        /// <param name="cacheKey">缓存键</param>
        public async Task RemoveAsync(string cacheKey)
        {
            Check.NotNullOrEmpty(cacheKey, nameof(cacheKey));
            WriteLog($"RemoveAsync : cacheKey = {cacheKey}");

            await _memcachedClient.RemoveAsync(this.HandleCacheKey(cacheKey));
        }
Ejemplo n.º 4
0
        public async Task InvalidateAsync(string key)
        {
            bool successfullyRemoved = await _memcachedClient.RemoveAsync(key).ConfigureAwait(false);

            if (!successfullyRemoved)
            {
                _logger.LogWarning($"Value for key {key} could not be removed from Memcached cache");
            }
        }
Ejemplo n.º 5
0
        public async Task Set <T>(string key, T value)
        {
            try
            {
                _logger.LogDebug($"Removendo item do cache com a chave: {key}");
                await _memcachedClient.RemoveAsync(key);

                _logger.LogDebug($"Registrando item do cache com a chave: {key}");
                await _memcachedClient.SetAsync(key, value, 60 * 60);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Falha ao registrar item no cache com a chave: {ex}");
            }
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Remove(string key)
        {
            try
            {
                var result = await _memcachedClient.RemoveAsync(key);

                if (result)
                {
                    return(NoContent());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status400BadRequest, result));
                }
            }
            catch (Exception ex)
            {
                return(this.ApiErrorResult(ex, _logger));
            }
        }
        public async Task <bool> cleanMemcacheCache()
        {
            await _memcachedClient.RemoveAsync(CacheKeys.OrderInfoWaitAndPolicyMemcache);

            await _memcachedClient.RemoveAsync(CacheKeys.OrdersInfoWaitAndPolicyMemcache);

            await _memcachedClient.RemoveAsync(CacheKeys.CityListWaitAndPolicyMemcache);

            await _memcachedClient.RemoveAsync(CacheKeys.OrderInfoPolicyMemcache);

            await _memcachedClient.RemoveAsync(CacheKeys.OrdersInfoPolicyMemcache);

            await _memcachedClient.RemoveAsync(CacheKeys.CityListPolicyMemcache);

            return(true);
        }
 public async Task RemoveAsync(string cacheKey)
 {
     await _cache.RemoveAsync(cacheKey);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Removes the specified cacheKey async.
        /// </summary>
        /// <returns>The async.</returns>
        /// <param name="cacheKey">Cache key.</param>
        public async Task RemoveAsync(string cacheKey)
        {
            ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));

            await _memcachedClient.RemoveAsync(this.HandleCacheKey(cacheKey));
        }
Ejemplo n.º 10
0
 public static Task <IOperationResult> RemoveAsync(this IMemcachedClient self, string key)
 {
     return(self.RemoveAsync(key, Protocol.NO_CAS));
 }
Ejemplo n.º 11
0
 public static IOperationResult Remove(this IMemcachedClient self, string key, ulong cas = Protocol.NO_CAS)
 {
     return(self.RemoveAsync(key, cas).RunAndUnwrap());
 }
Ejemplo n.º 12
0
        public async Task HandleNewSubscriberEvent(NewSubscriberEvent e)
        {
            var id = await _repository.FindByUUID <Schedule>(e.ParentScheduleUuid).Select(x => x.Id).FirstOrDefaultAsync();

            await _cache.RemoveAsync(CacheKeyStore.ScheduleFollowings(id));
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 删除,用户信息
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public async Task RemoveUserInfo(long userid)
 {
     await _cache.RemoveAsync(GetUserInfoKey(userid));
 }
Ejemplo n.º 14
0
 public virtual async Task RemoveAsync <T>(string key)
 {
     await memcachedClient.RemoveAsync(key);
 }
Ejemplo n.º 15
0
 public async Task RemoveAsync(string key)
 {
     await _memoryCache.RemoveAsync(key);
 }
Ejemplo n.º 16
0
 public Task <bool> RemoveAsync(string key)
 {
     return(_memcachedClient.RemoveAsync(key));
 }
 public async void Remove_Should_Fail_With_IOException_When_Target_Node_Is_Offline()
 {
     IfThrows <IOException>(await client.RemoveAsync(GetUniqueKey(), 0));
 }
Ejemplo n.º 18
0
 public async Task RemoveAsync(string key)
 {
     await _client.RemoveAsync(key);
 }