Skip to content

Commit

Permalink
Added UseViewCache in cached config values
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Sep 11, 2024
1 parent fd5de86 commit b96dc56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sources/MVCFramework.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ TMVCEngine = class(TComponent)
fConfigCache_DefaultContentType: String;
fConfigCache_DefaultContentCharset: String;
fConfigCache_PathPrefix: String;
fConfigCache_UseViewCache: Boolean;
fSerializers: TDictionary<string, IMVCSerializer>;
fMiddlewares: TList<IMVCMiddleware>;
fControllers: TObjectList<TMVCControllerDelegate>;
Expand Down Expand Up @@ -1271,6 +1272,7 @@ TMVCBaseViewEngine = class(TMVCBase)
FContentType: string;
FOutput: string;
protected
FUseViewCache: Boolean;
FJSONModel: TJSONObject;
function GetRealFileName(const AViewName: string): string; virtual;
function IsCompiledVersionUpToDate(const AFileName, ACompiledFileName: string): Boolean; virtual; abstract;
Expand Down Expand Up @@ -3759,6 +3761,7 @@ procedure TMVCEngine.SaveCacheConfigValues;
FConfigCache_DefaultContentType := Config[TMVCConfigKey.DefaultContentType];
FConfigCache_DefaultContentCharset := Config[TMVCConfigKey.DefaultContentCharset];
FConfigCache_PathPrefix := Config[TMVCConfigKey.PathPrefix];
FConfigCache_UseViewCache := Config[TMVCConfigKey.ViewCache] = 'true';
end;

class function TMVCEngine.SendSessionCookie(const AContext: TWebContext;
Expand Down Expand Up @@ -4791,7 +4794,9 @@ procedure TMVCRenderer.Render<T>(const AStatusCode: Integer; const ACollection:

function TMVCController.GetRenderedView(const AViewNames: TArray<string>): string;
var
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringBuilder;
lView: TMVCBaseViewEngine;
lViewName: string;
lStrStream: TStringBuilder;
begin
lStrStream := TStringBuilder.Create;
try
Expand Down Expand Up @@ -5185,6 +5190,7 @@ constructor TMVCBaseViewEngine.Create(
FViewModel := AViewModel;
FContentType := AContentType;
FOutput := EmptyStr;
FUseViewCache := Engine.fConfigCache_UseViewCache;
end;

constructor TMVCBaseViewEngine.Create(
Expand Down

0 comments on commit b96dc56

Please sign in to comment.