コード例 #1
0
        public async Task <Bitmap> GetAsync(string image)
        {
            if (string.IsNullOrEmpty(image))
            {
                return(await decorated.GetAsync(image));
            }
            var bitmap = cache.Get(image) as Bitmap;

            if (bitmap != null)
            {
                return(await Task.Run(() => bitmap));
            }

            bitmap = await decorated.GetAsync(image);

            if (bitmap != null)
            {
                cache.Put(image, bitmap);
            }
            return(bitmap);
        }
コード例 #2
0
 public Task <Bitmap> GetBitmapAsync(string image)
 {
     return(bitmapRepository.GetAsync(image));
 }