示例#1
0
        public static void TestRedisClient()
        {
            CacheLoaderRedisClient RedisCacheServer = new CacheLoaderRedisClient("192.168.1.48", 6379);

            System.Console.WriteLine(RedisCacheServer.GetStoredJSONForKey("customer.key=1"));

            System.Console.WriteLine();
            System.Console.WriteLine();

            System.Console.WriteLine(RedisCacheServer.GetStoredJSONForKey("calcustomers.key=2"));

            System.Console.WriteLine();
            System.Console.WriteLine();

            System.Console.WriteLine("Obtaining row dictionary using Redis Client Get Row Dictionary Method");
            Dictionary<string, string> JSONDict = RedisCacheServer.GetStoredRowDictionaryForKey("calcustomers.key=1");
            System.Console.WriteLine("Success obtaining Row Dictionary...");

            System.Console.WriteLine("Obtaining complete rows dictionary objects using Redis Client Get Row Dictionary Method");
            List<Dictionary<string, string>> JSONDictCollection = RedisCacheServer.GetCachedRowsDictionaryCollectionForKeyPrefix("customer");
            System.Console.WriteLine("Success obtaining Row Dictionary...");

            System.Console.WriteLine("Obtaining complete Data table with row objects using Redis Client Get Data Table Method");
            DataTable MyCachedTable = RedisCacheServer.GetDataTableForCacheKeyPrefix("customer");
            System.Console.WriteLine("Success obtaining DataTable with cached rows...");

            System.Console.WriteLine();
            System.Console.WriteLine();

            System.Console.WriteLine("Obtaining City Name for Customer with Id 3");
            System.Console.WriteLine("City Name is: {0}", RedisCacheServer.GetColumnValueForRowKeyandColumnName("customer.key=3", "city"));

            System.Console.WriteLine();
            System.Console.WriteLine();

            /*
             * Client example using model objects
             */
            Developer model = RedisCacheServer.GetCachedModelObjectForKey<Developer>("mbsdeveloper.key=ARCHITECT+JEFFREYLANGLEY");

            List<Developer> myList = RedisCacheServer.GetCachedModelsCollectionForKeyPrefix<Developer>("mbsdeveloper");

            List<Film> myMovieList = RedisCacheServer.GetCachedModelsCollectionForKeyPrefix<Film>("film");

            System.Console.WriteLine();
            System.Console.WriteLine();

        }
示例#2
0
        public static void RetrieveCustomerObjects()
        {
            CacheLoaderRedisClient RedisCacheServer = new CacheLoaderRedisClient("192.168.1.48", 6379);


            List<Customer> MyCustomers = RedisCacheServer.GetCachedModelsCollectionForKeyPrefix<Customer>("customer");

        }