Added UseViewCache in cached config values

This commit is contained in:
Daniele Teti 2024-09-11 11:14:40 +02:00
parent fd5de8660c
commit b96dc56b6d

View File

@ -1073,6 +1073,7 @@ type
fConfigCache_DefaultContentType: String; fConfigCache_DefaultContentType: String;
fConfigCache_DefaultContentCharset: String; fConfigCache_DefaultContentCharset: String;
fConfigCache_PathPrefix: String; fConfigCache_PathPrefix: String;
fConfigCache_UseViewCache: Boolean;
fSerializers: TDictionary<string, IMVCSerializer>; fSerializers: TDictionary<string, IMVCSerializer>;
fMiddlewares: TList<IMVCMiddleware>; fMiddlewares: TList<IMVCMiddleware>;
fControllers: TObjectList<TMVCControllerDelegate>; fControllers: TObjectList<TMVCControllerDelegate>;
@ -1271,6 +1272,7 @@ type
FContentType: string; FContentType: string;
FOutput: string; FOutput: string;
protected protected
FUseViewCache: Boolean;
FJSONModel: TJSONObject; FJSONModel: TJSONObject;
function GetRealFileName(const AViewName: string): string; virtual; function GetRealFileName(const AViewName: string): string; virtual;
function IsCompiledVersionUpToDate(const AFileName, ACompiledFileName: string): Boolean; virtual; abstract; function IsCompiledVersionUpToDate(const AFileName, ACompiledFileName: string): Boolean; virtual; abstract;
@ -3759,6 +3761,7 @@ begin
FConfigCache_DefaultContentType := Config[TMVCConfigKey.DefaultContentType]; FConfigCache_DefaultContentType := Config[TMVCConfigKey.DefaultContentType];
FConfigCache_DefaultContentCharset := Config[TMVCConfigKey.DefaultContentCharset]; FConfigCache_DefaultContentCharset := Config[TMVCConfigKey.DefaultContentCharset];
FConfigCache_PathPrefix := Config[TMVCConfigKey.PathPrefix]; FConfigCache_PathPrefix := Config[TMVCConfigKey.PathPrefix];
FConfigCache_UseViewCache := Config[TMVCConfigKey.ViewCache] = 'true';
end; end;
class function TMVCEngine.SendSessionCookie(const AContext: TWebContext; class function TMVCEngine.SendSessionCookie(const AContext: TWebContext;
@ -4791,7 +4794,9 @@ end;
function TMVCController.GetRenderedView(const AViewNames: TArray<string>): string; function TMVCController.GetRenderedView(const AViewNames: TArray<string>): string;
var var
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringBuilder; lView: TMVCBaseViewEngine;
lViewName: string;
lStrStream: TStringBuilder;
begin begin
lStrStream := TStringBuilder.Create; lStrStream := TStringBuilder.Create;
try try
@ -5185,6 +5190,7 @@ begin
FViewModel := AViewModel; FViewModel := AViewModel;
FContentType := AContentType; FContentType := AContentType;
FOutput := EmptyStr; FOutput := EmptyStr;
FUseViewCache := Engine.fConfigCache_UseViewCache;
end; end;
constructor TMVCBaseViewEngine.Create( constructor TMVCBaseViewEngine.Create(