public async Task <ICollection <NoteModels> > GetReminderNotes(long Id) { var cacheKey = "ReminderNotes:" + Id.ToString(); string serializedNotes; ICollection <NoteModels> Notes; try { var redisNoteCollection = await distributedCache.GetAsync(cacheKey); if (redisNoteCollection != null) { serializedNotes = Encoding.UTF8.GetString(redisNoteCollection); Notes = JsonConvert.DeserializeObject <List <NoteModels> >(serializedNotes); } else { Notes = notesRL.GetReminderNotes(Id); await redis.AddRedisCache(cacheKey, Notes); } return(Notes); } catch (Exception) { throw; } }