Added identifier and fetch time product listings; Added persistence to AdafruitShop.
Implemented in AdafruitShop. AdafruitShop Product listing data now persisted. AdafruitShop configuration now persisted.
This commit is contained in:
		@@ -0,0 +1,19 @@
 | 
			
		||||
namespace Props.Shop.Adafruit.Persistence
 | 
			
		||||
{
 | 
			
		||||
    public class Configuration
 | 
			
		||||
    {
 | 
			
		||||
        public const string FILE_NAME = "config.json";
 | 
			
		||||
        public int MinDownloadInterval { get; set; }
 | 
			
		||||
        public int CacheLifespan { get; set; }
 | 
			
		||||
        public float Similarity { get; set; }
 | 
			
		||||
        public string ProductListingCacheFileName { get; set; }
 | 
			
		||||
 | 
			
		||||
        public Configuration()
 | 
			
		||||
        {
 | 
			
		||||
            MinDownloadInterval = 5 * 60 * 1000;
 | 
			
		||||
            Similarity = 0.8f;
 | 
			
		||||
            CacheLifespan = 5 * 60 * 1000;
 | 
			
		||||
            ProductListingCacheFileName = "ProductListings.json";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Props.Shop.Framework;
 | 
			
		||||
 | 
			
		||||
namespace Props.Shop.Adafruit.Persistence
 | 
			
		||||
{
 | 
			
		||||
    public class ProductListingCacheData
 | 
			
		||||
    {
 | 
			
		||||
        public const string FILE_NAME = "Product-listing-cache.json";
 | 
			
		||||
        public DateTime LastUpdatedUtc { get; private set; }
 | 
			
		||||
        public IReadOnlyDictionary<string, IList<ProductListing>> ProductListings { get; set; }
 | 
			
		||||
 | 
			
		||||
        public ProductListingCacheData(IReadOnlyDictionary<string, IList<ProductListing>> productListings)
 | 
			
		||||
        {
 | 
			
		||||
            this.ProductListings = productListings;
 | 
			
		||||
            LastUpdatedUtc = DateTime.UtcNow;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ProductListingCacheData()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user