Exemplo n.º 1
0
        /// <summary>
        /// Saves a FileCacheIndex object to the cache
        /// </summary>
        /// <param name="requestUrl"></param>
        /// <param name="file"></param>
        /// <param name="config"></param>
        /// <param name="checksum"></param>
        public static async Task saveAsync(string requestUrl, Stream file, IonConfig config, string checksum)
        {
            if (file == null)
            {
                return;
            }

            if (checksum == null)
            {
                checksum = "sha256:" + HashUtils.GetSHA256Hash(file);
            }

            FileCacheIndex cacheIndex = new FileCacheIndex(requestUrl, checksum, DateTimeUtils.now());
            await CacheIndexStore.save(requestUrl, cacheIndex, config).ConfigureAwait(false);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Saves a pageCacheIndex to cache
 /// </summary>
 /// <param name="page"></param>
 /// <param name="config"></param>
 public static async Task save(IonPage page, IonConfig config)
 {
     string         url        = PagesURLs.getPageURL(config, page.identifier);
     PageCacheIndex cacheIndex = new PageCacheIndex(url, page.last_changed);
     await CacheIndexStore.save <PageCacheIndex>(url, cacheIndex, config).ConfigureAwait(false);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Saves a collectionCacheIndex to cache
 /// </summary>
 /// <param name="config"></param>
 /// <param name="lastModified"></param>
 public static async Task save(IonConfig config, DateTime lastModified)
 {
     string collectionURL            = PagesURLs.getCollectionURL(config);
     CollectionCacheIndex cacheIndex = new CollectionCacheIndex(collectionURL, DateTimeUtils.now().ToUniversalTime(), lastModified);
     await CacheIndexStore.save(collectionURL, cacheIndex, config).ConfigureAwait(false);
 }