I have a test service that is getting random media from umbraco. I was originally using the media cache from the umbraco context but I noticed that all of my media stopped being accessible this way.
Media Cache:
var imageMedia = _umbracoContext.MediaCache.GetByContentType(Image.GetModelContentType()).ToList();
Media Service:
var imageMediaCount = _mediaService.Count(Image.ModelTypeAlias);
var imageMedia = _mediaService.GetPagedOfType(Image.GetModelContentType().Id, 0, imageMediaCount, out var totalRecords).ToList();
Which one should I be using? If it's the cache, why is my media gone? I'd like to get all of my image media into a single list. I've also ran into an issue with the media service and can't find a way to access the url of the image.
if you are using this code for the frontend, you need to used the cache-version, otherwise your site may use all the CPU on the database server, causing the db to become unresponsive
How does media get into the media cache? I have about 30 images in my media section and when I try to find them with the media cache there are 0 results. A few days ago it was finding all 30 of my images and now it is finding none. The media service is able to find everything though. But I'd rather deal with IPublishedContent than IMedia.
Media Cache vs Media Service
I have a test service that is getting random media from umbraco. I was originally using the media cache from the umbraco context but I noticed that all of my media stopped being accessible this way.
Media Cache:
Media Service:
Which one should I be using? If it's the cache, why is my media gone? I'd like to get all of my image media into a single list. I've also ran into an issue with the media service and can't find a way to access the url of the image.
if you are using this code for the frontend, you need to used the cache-version, otherwise your site may use all the CPU on the database server, causing the db to become unresponsive
How does media get into the media cache? I have about 30 images in my media section and when I try to find them with the media cache there are 0 results. A few days ago it was finding all 30 of my images and now it is finding none. The media service is able to find everything though. But I'd rather deal with IPublishedContent than IMedia.
is working on a reply...