Listing D Module TestCache Sub Main() ''Creates a String which contains the Alphabet A..Z Dim s As New String("ABCDEFGHIJKLMNOPQRSTUVWXYZ") ''Inserts the String into the Cache using a string key of "Alphabet" ''Sets the expiration date to the current date and time plus one minute UnitTest.CustomCache.insertCachedObject("Alphabet", s, Now().AddMinutes(1)) ''Declares a Second String called s1 Dim s1 As String ''Retrieves the cache object which matches the key of "Alphabet" s1 = UnitTest.CustomCache.getCachedObject("Alphabet") ''This should output the alphabet A..X Console.WriteLine(s1) ''Don''t hit the enter key until see item expired in the console window Console.ReadLine() ''Declares a Third String called s1 Dim s3 As String ''Retrieves the cache object which matches the key of "Alphabet" s3 = UnitTest.CustomCache.getCachedObject("Alphabet") ''This should output the alphabet A..X Console.WriteLine(s3) ''By performing a Console.readline it allows us to see the '' output of the console window prior to its closing Console.ReadLine() End Sub End Module |