本文整理匯總了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);
}
}
}
示例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));
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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));
}
}
}
示例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()));
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}