$genericCacheManager(Redis)_Add
by mtambulut
JavaScript
/**
Redis Chace nasıl yazarız;
1-Dominos.OnlineOrder.Common \ Caching \ CacheKey.cs buraya tanımlamayı yapıyorsun;
public const string ALL_UNIVERSITY_CITIES = "ALL_UNIVERSITY_CITIES";
2-Dominos.OnlineOrder.Services \UniversityStore \ UniversityApiServices.svc ;
ICacheService cacheService = CommonServiceLocator<ICacheService>.GetService("genericCacheService");
var cities = cacheService.Get(CacheKey.ALL_UNIVERSITY_CITIES, () =>
{
var service = new UniversityService(GetRepositoryFactory());
var result = service.GetAllCities();
if (result != null) // Bazı illerin yukarıda görünmesi için
{
const int ISTANBUL = 34;
const int ANKARA = 6;
const int IZMIR = 35;
return result.ToContract().OrderBy(x => x.Name)
.OrderByDescending(x => x.Id == IZMIR)
.OrderByDescending(x => x.Id == ANKARA)
.OrderByDescending(x => x.Id == ISTANBUL)
.ToList();
}
return null;
});
return cities;
*/