示例#1
0
        static void Main(string[] args)
        {
            var key      = ConfigurationManager.AppSettings["embedly.key"];
            var database = ConfigurationManager.ConnectionStrings["embedly.cache"];

            // using the in memory Cache
            var cache = new InMemoryResponseCache(new TimeSpan(24, 0, 0));

            // using the Ado Cache (e.g. SQL Server)

            /*
             * var factory = DbProviderFactories.GetFactory(database.ProviderName);
             * var cache = new AdoResponseCache(factory, database.ConnectionString);
             */

            // using the MongoDB Cache
            // var cache = new MongoResponseCache(database.ConnectionString);

            try
            {
                var client = new Client(key, cache);

                Providers(client);
                ProviderInformation(client);
                ProviderPerUrl(client);
                SingleRich(client);
                SingleVideo(client);
                MultipleFilterByProvider(client);
                MultipleFilterByType(client);
                MultipleAll(client);
                UrlNotFound(client);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Enter your embedly account key in the config file");
            }

            Console.WriteLine();
            Console.WriteLine("Finished");
            Console.ReadLine();
        }
		public void Setup()
		{
			var tempMemoryCache = new MemoryCache(Guid.NewGuid().ToString());
			_responseCache = new InMemoryResponseCache(tempMemoryCache);
		}