In IOS Im generating an image in runtime, in order to cache it on disk with FFImageLoading im doing the following:
TaskCompletionSource<Stream> imageTcs = new TaskCompletionSource<Stream>();
var stream = uimage.AsPNG().AsStream();
imageTcs.TrySetResult(stream);
var taskParams = ImageService.Instance.LoadStream(sct => imageTcs.Task);
taskParams = taskParams.BitmapOptimizations(false);
taskParams = taskParams.WithPriority(LoadingPriority.Low);
taskParams = taskParams.WithCache(FFImageLoading.Cache.CacheType.Disk);
taskParams = taskParams.CacheKey(name);
ImageService.Instance.LoadImage(task);
Now the question is if i want to load this image again from cache how do i do it?, i can't find a way to load an image, previously loaded as a stream.
Thank you for the attention.
I figured it out i just needed to use ImageService.Instance.Config.DiskCache.
AddToSavingQueueIfNotExistsAsync to add a byte array to the disk cache.
Use ImageService.Instance.Config.DiskCache.ExistsAsync(id) to see if it exists.
And finally ImageService.Instance.Config.DiskCache.TryGetStreamAsync(id) to get a stream with the bytes.
Most helpful comment
I figured it out i just needed to use ImageService.Instance.Config.DiskCache.
AddToSavingQueueIfNotExistsAsync to add a byte array to the disk cache.
Use ImageService.Instance.Config.DiskCache.ExistsAsync(id) to see if it exists.
And finally ImageService.Instance.Config.DiskCache.TryGetStreamAsync(id) to get a stream with the bytes.