當前位置: 首頁>>代碼示例>>C#>>正文


C# PooledRedisClientManager.GetCacheClient方法代碼示例

本文整理匯總了C#中ServiceStack.Redis.PooledRedisClientManager.GetCacheClient方法的典型用法代碼示例。如果您正苦於以下問題:C# PooledRedisClientManager.GetCacheClient方法的具體用法?C# PooledRedisClientManager.GetCacheClient怎麽用?C# PooledRedisClientManager.GetCacheClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ServiceStack.Redis.PooledRedisClientManager的用法示例。


在下文中一共展示了PooledRedisClientManager.GetCacheClient方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SaveMeals

        public static bool SaveMeals(IList<Meal> meals)
        {
            using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
            {
                using (var client = redisManager.GetCacheClient())
                {
                    IList<bool> result = new List<bool>();
                    //save meals by date...add to workout dates
                    foreach (Meal meal in meals)
                    {
                        Meal tempMeal = client.Get<Meal>(String.Format(saveMeals, meal.MealDate));
                        if (tempMeal != null && tempMeal.Foods != null)
                        {
                            foreach (var food in meal.Foods)
                                tempMeal.Foods.Add(food);
                            result.Add(client.Set<Meal>(String.Format(saveMeals, meal.MealDate), tempMeal));
                        }
                        else
                        {
                            result.Add(client.Add<Meal>(String.Format(saveMeals, meal.MealDate), meal));
                            WorkoutClient.AddWorkoutDate(meal.MealDate.Date);
                        }
                    }

                    return !result.Contains(false);
                }
            }
        }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:28,代碼來源:MealClient.cs

示例2: RetrieveWorkout

 public static Workout RetrieveWorkout(DateTime dateTime)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<Workout>(String.Format(selectWorkout,dateTime));
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:WorkoutClient.cs

示例3: SaveExercises

 public static bool SaveExercises(IList<Event> exercises)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Add<IList<Event>>(selectExercises, exercises);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:ExerciseClient.cs

示例4: SaveProfile

 public static bool SaveProfile(IList<CurrentStatistic> profile)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Add<IList<CurrentStatistic>>(getProfile, profile);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:ProfileClient.cs

示例5: SaveGoals

 public static bool SaveGoals(IList<ContestEventGoal> goals)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Add<IList<ContestEventGoal>>(getGoals, goals);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:ProfileClient.cs

示例6: RetrieveProfile

 public static IList<Entities.CurrentStatistic> RetrieveProfile()
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<IList<CurrentStatistic>>(getProfile);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:ProfileClient.cs

示例7: RetrieveGoals

 public static IList<Entities.ContestEventGoal> RetrieveGoals()
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<IList<ContestEventGoal>>(getGoals);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:ProfileClient.cs

示例8: SaveFoods

 public static bool SaveFoods(IList<Food> foods)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Add<IList<Food>>(selectFoods, foods);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:FoodClient.cs

示例9: GetFoodEntries

 public static IList<FoodEntry> GetFoodEntries(DateTime entryDate)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<IList<FoodEntry>>(String.Format(getFoodEntries, entryDate));
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:MealClient.cs

示例10: RetrieveCompleteFood

 public static Food RetrieveCompleteFood(int id)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<Food>(String.Format(completeFood, id.ToString()));
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:FoodClient.cs

示例11: RetrieveWorkoutDates

 public static IList<DateTime> RetrieveWorkoutDates()
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             return client.Get<IList<DateTime>>(selectWorkoutDates);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:10,代碼來源:WorkoutClient.cs

示例12: AddContestEvent

 public static bool AddContestEvent(ContestEvent contestEvent, int contestId)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             var contestEvents = client.Get<IList<ContestEvent>>(String.Format(selectContestEvents, contestId));
             if (contestEvents != null)
                 contestEvents.Add(contestEvent);
             return client.Set<IList<ContestEvent>>(String.Format(selectContestEvents, contestId), contestEvents);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:13,代碼來源:ContestClient.cs

示例13: AddWorkoutDate

 public static bool AddWorkoutDate(DateTime workoutDate)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             IList<DateTime> workoutDates = client.Get<IList<DateTime>>(selectWorkoutDates);
             if (!workoutDates.Contains(workoutDate))
                 workoutDates.Add(workoutDate);
             return client.Set<IList<DateTime>>(selectWorkoutDates, workoutDates);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:13,代碼來源:WorkoutClient.cs

示例14: RemoveContestEvent

 public static bool RemoveContestEvent(ContestEvent contestEvent, int contestId)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             var contestEvents = client.Get<IList<ContestEvent>>(String.Format(selectContestEvents, contestId));
             if (contestEvents != null)
             {
                 ContestEvent contestEventToRemove = contestEvents.FirstOrDefault(t => t.EventName.Equals(contestEvent.EventName));
                 contestEvents.Remove(contestEventToRemove);
             }
             return client.Set<IList<ContestEvent>>(String.Format(selectContestEvents, contestId), contestEvents);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:16,代碼來源:ContestClient.cs

示例15: RemoveContest

 public static bool RemoveContest(Contest contest)
 {
     using (var redisManager = new PooledRedisClientManager("[email protected]:9038"))
     {
         using (var client = redisManager.GetCacheClient())
         {
             var contests = client.Get<IList<Contest>>(selectContests);
             if (contests != null)
             {
                 Contest contestToRemove = contests.FirstOrDefault(t => t.ContestId == contest.ContestId);
                 contests.Remove(contestToRemove);
             }
             return client.Set<IList<Contest>>(selectContests, contests);
         }
     }
 }
開發者ID:dimtruck,項目名稱:The-Challenge,代碼行數:16,代碼來源:ContestClient.cs


注:本文中的ServiceStack.Redis.PooledRedisClientManager.GetCacheClient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。