Beispiel #1
0
        static void _RunCacheDemo2()
        {
            // demos the secondary (url based) caching
            // make it hit the server less (about every
            // 5 minutes usually (depending on machine
            // policy)
            Tmdb.CacheLevel = JsonRpcCacheLevel.Aggressive;

            // grab the show changes just so we have something to work with.
            // this is a non-caching function which means it doesn't use
            // the primary (memory) cache, but it will use this one.
            try
            {
                foreach (var show in Tmdb.GetShowChanges(DateTime.UtcNow, maxPage: 2))
                {
                    Console.WriteLine(show.Name);
                }
            }
            catch (JsonRpcException rex)
            {
                Console.Error.WriteLine("Error: " + rex.Json.ToString());
            }
            Console.WriteLine("Press any key...");
            Console.Read();
            Console.Clear();
            Console.WriteLine("Hopefully cached and faster (also no request limit delay if cache mode is aggressive)");
            // do it again, this time with some cache hits.
            try
            {
                foreach (var show in Tmdb.GetShowChanges(DateTime.UtcNow, maxPage: 2))
                {
                    Console.WriteLine(show.Name);
                }
            }
            catch (JsonRpcException rex)
            {
                Console.Error.WriteLine("Error: " + rex.Json.ToString());
            }
        }