2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 28 Jan 2004 01:01:12 +0000 (01:01 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 28 Jan 2004 01:01:12 +0000 (01:01 -0000)
* AspGenerator.cs: use the Cache to store compiled Types. Don't parse
pages more than once. Thanks to Eric Lindvall for pointing this out.

svn path=/trunk/mcs/; revision=22557

mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog

index 7073ae30402a48abe926e8de38574560efee6ba3..3045ecc89647d9f878b833686a6d36aeb44bc686 100644 (file)
@@ -11,6 +11,7 @@ using System.Collections;
 using System.CodeDom.Compiler;
 using System.IO;
 using System.Text;
+using System.Web.Caching;
 using System.Web.UI;
 using System.Web.Util;
 
@@ -176,6 +177,11 @@ namespace System.Web.Compilation
 
                public Type GetCompiledType ()
                {
+                       Type type = (Type) HttpRuntime.Cache.Get (tparser.InputFile);
+                       if (type != null) {
+                               return type;
+                       }
+
                        InitParser (Path.GetFullPath (tparser.InputFile));
                        DoParse ();
 #if DEBUG
@@ -188,7 +194,12 @@ namespace System.Web.Compilation
 
                        BaseCompiler compiler = GetCompilerFromType ();
 
-                       return compiler.GetCompiledType ();
+                       type = compiler.GetCompiledType ();
+                       CacheDependency cd = new CacheDependency ((string[])
+                                                       tparser.Dependencies.ToArray (typeof (string)));
+
+                       HttpRuntime.Cache.Insert (tparser.InputFile, type, cd);
+                       return type;
                }
 
 #if DEBUG
index e9ec14a51a7e441dbd0a8db87db5de3e17a58e77..6c054a6438e928deb975a808417bd1d9f127f3e4 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * AspGenerator.cs: use the Cache to store compiled Types. Don't parse
+       pages more than once. Thanks to Eric Lindvall for pointing this out.
+
 2004-01-23  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * TemplateControlCompiler.cs: allow handling subproperties for other