Hi
I have same issue like this
I have created one ActionResult to get all call categories like this
[NopHttpsRequirement(SslRequirement.No)]
public ActionResult Collections()
{
var pictureSize = _mediaSettings.CategoryThumbPictureSize;
//using cache here
string categoriesCacheKey = string.Format(ModelCacheEventConsumer.CATEGORY_COLLECTIONS_KEY,
string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
pictureSize,
_storeContext.CurrentStore.Id,
_workContext.WorkingLanguage.Id,
_webHelper.IsCurrentConnectionSecured());
var model = _cacheManager.Get(categoriesCacheKey, () =>
_categoryService.GetAllCategories()
.Select(x =>
{
var catModel = x.ToModel();
//prepare picture model
var categoryPictureCacheKey = string.Format(ModelCacheEventConsumer.CATEGORY_PICTURE_MODEL_KEY, x.Id, pictureSize, true, _workContext.WorkingLanguage.Id, _webHelper.IsCurrentConnectionSecured(), _storeContext.CurrentStore.Id);
catModel.PictureModel = _cacheManager.Get(categoryPictureCacheKey, () =>
{
var picture = _pictureService.GetPictureById(x.PictureId);
var pictureModel = new PictureModel
{
FullSizeImageUrl = _pictureService.GetPictureUrl(picture),
ImageUrl = _pictureService.GetPictureUrl(picture, pictureSize),
Title = string.Format(_localizationService.GetResource("Media.Category.ImageLinkTitleFormat"), catModel.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Category.ImageAlternateTextFormat"), catModel.Name)
};
return pictureModel;
});
return catModel;
})
.ToList()
);
if (!model.Any())
return Content("");
return View(model);
}
I also created the key for cache
public const string CATEGORY_COLLECTIONS_KEY = "Nop.pres.category.collections-{0}-{1}-{2}-3{}-{4}";
public const string CATEGORY_COLLECTIONS_PATTERN_KEY = "Nop.pres.category.collections";
So if i change picture of category in admin then i go to front-end it does not change.It only change when i clear cache in admin
Not sure where is reason why?
Thank you