mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Removed MVCUseTemplateCache (duplicated of TMVCConfigKey.ViewCache)
This commit is contained in:
parent
b96dc56b6d
commit
dc04b27ace
@ -505,7 +505,8 @@ begin
|
||||
end;
|
||||
Section
|
||||
.AppendLine(' //use Context property to access to the HTTP request and response')
|
||||
.AppendLine(' Result := ''Hello DelphiMVCFramework World'';')
|
||||
.AppendLine(' Result := ''<p>Hello <strong>DelphiMVCFramework</strong> World</p>'' + ')
|
||||
.AppendLine(' ''<p><small>dmvcframework-'' + DMVCFRAMEWORK_VERSION + ''</small></p>'';')
|
||||
.AppendLine('end;')
|
||||
.AppendLine
|
||||
.AppendLine('function ' + Model[TConfigKey.controller_classname] + '.GetReversedString(const Value: String): String;')
|
||||
@ -665,6 +666,7 @@ begin
|
||||
.AppendLine(' public')
|
||||
.AppendLine(' [MVCPath]')
|
||||
.AppendLine(' [MVCHTTPMethod([httpGET])]')
|
||||
.AppendLine(' [MVCProduces(TMVCMediaType.TEXT_HTML)]')
|
||||
.AppendLine(' function Index: String;')
|
||||
.AppendLine
|
||||
.AppendLine(' [MVCPath(''/reversedstrings/($Value)'')]')
|
||||
@ -1045,8 +1047,6 @@ begin
|
||||
.AppendLine(' // UseConsoleLogger defines if logs must be emitted to also the console (if available).')
|
||||
.AppendLine(' UseConsoleLogger := True;')
|
||||
.AppendLine()
|
||||
.AppendLine(' // MVCUseTemplatesCache allows to cache compiled templates on disk for a faster future execution (if engine supports it).')
|
||||
.AppendLine(' MVCUseTemplatesCache := True;')
|
||||
.AppendLine()
|
||||
.AppendLine(' LogI(''** DMVCFramework Server ** build '' + DMVCFRAMEWORK_VERSION);');
|
||||
|
||||
@ -1396,12 +1396,12 @@ begin
|
||||
.AppendLine(' TemplatePro, System.SysUtils;')
|
||||
.AppendLine
|
||||
.AppendLine
|
||||
.AppendLine('function MyHelper1(const Value: TValue; const Parameters: TArray<string>): string;')
|
||||
.AppendLine('function MyHelper1(const Value: TValue; const Parameters: TArray<string>): TValue;')
|
||||
.AppendLine('begin')
|
||||
.AppendLine(' Result := Value.ToString + '' (I''''m The MyHelper1)'';')
|
||||
.AppendLine('end;')
|
||||
.AppendLine
|
||||
.AppendLine('function MyHelper2(const Value: TValue; const Parameters: TArray<string>): string;')
|
||||
.AppendLine('function MyHelper2(const Value: TValue; const Parameters: TArray<string>): TValue;')
|
||||
.AppendLine('begin')
|
||||
.AppendLine(' Result := Value.ToString + '' (I''''m The MyHelper2)'';')
|
||||
.AppendLine('end;')
|
||||
@ -1452,8 +1452,8 @@ begin
|
||||
.AppendLine('uses')
|
||||
.AppendLine(' System.Rtti;')
|
||||
.AppendLine
|
||||
.AppendLine('function MyHelper1(const Value: TValue; const Parameters: TArray<string>): string;')
|
||||
.AppendLine('function MyHelper2(const Value: TValue; const Parameters: TArray<string>): string;')
|
||||
.AppendLine('function MyHelper1(const Value: TValue; const Parameters: TArray<string>): TValue;')
|
||||
.AppendLine('function MyHelper2(const Value: TValue; const Parameters: TArray<string>): TValue;')
|
||||
.AppendLine
|
||||
.AppendLine
|
||||
.AppendLine('procedure TemplateProContextConfigure;')
|
||||
|
@ -640,10 +640,6 @@ var
|
||||
/// </summary>
|
||||
MVCSerializeNulls: Boolean = True;
|
||||
|
||||
/// <summary>
|
||||
/// If "true" server side views templates are cached on disk for better performance.
|
||||
/// </summary>
|
||||
MVCUseTemplatesCache: Boolean = True;
|
||||
{ GLOBAL CONFIG VARS // END}
|
||||
|
||||
|
||||
|
@ -93,9 +93,6 @@ type
|
||||
TSynMustacheAccess = class(TSynMustache)
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
var
|
||||
gPartialsLoaded : Boolean = False;
|
||||
gHelpersLoaded : Boolean = False;
|
||||
@ -139,7 +136,7 @@ var
|
||||
begin
|
||||
PrepareModels;
|
||||
lViewFileName := GetRealFileName(ViewName);
|
||||
if not FileExists(lViewFileName) then
|
||||
if lViewFileName.IsEmpty then
|
||||
raise EMVCFrameworkViewException.CreateFmt('View [%s] not found', [ViewName]);
|
||||
lViewTemplate := StringToUTF8(TFile.ReadAllText(lViewFileName, TEncoding.UTF8));
|
||||
lViewEngine := TSynMustache.Parse(lViewTemplate);
|
||||
|
@ -122,8 +122,9 @@ var
|
||||
begin
|
||||
lUseCompiledVersion := False;
|
||||
lViewFileName := GetRealFileName(ViewName);
|
||||
|
||||
if MVCUseTemplatesCache then
|
||||
if lViewFileName.IsEmpty then
|
||||
raise EMVCFrameworkViewException.CreateFmt('View [%s] not found', [ViewName]);
|
||||
if FUseViewCache then
|
||||
begin
|
||||
lCacheDir := TPath.Combine(TPath.GetDirectoryName(lViewFileName), '__cache__');
|
||||
TDirectory.CreateDirectory(lCacheDir);
|
||||
@ -151,7 +152,7 @@ begin
|
||||
try
|
||||
lViewTemplate := TFile.ReadAllText(lViewFileName);
|
||||
lCompiledTemplate := lTP.Compile(lViewTemplate, lViewFileName);
|
||||
if MVCUseTemplatesCache then
|
||||
if FUseViewCache then
|
||||
begin
|
||||
lCompiledTemplate.SaveToFile(lCompiledViewFileName);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user