Пример #1
0
        /// <summary>
        /// Helper function to cache or retrieve from the cache the image bytes
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="pageKey"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="pageDataGenerator"></param>
        /// <returns></returns>
        public static IObservable <byte[]> GetOrFetchPageImageData(this IBlobCache cache, string pageKey, double width, double height, Func <IObservable <byte[]> > pageDataGenerator)
        {
            string pageDataKey = string.Format("{0}-w{1}-h{2}", pageKey, width, height);

            return(cache.GetOrFetch(pageDataKey, pageDataGenerator, DateTime.Now + Settings.PageCacheTime));
        }