delphimvcframework/samples/outputcachewithredis/WebModuleU.pas
Daniele Teti 54c82554e6 ADD Cache support based on Redis
MVCFramework.Controllers.CacheController.pas
2016-11-07 12:24:13 +01:00

49 lines
1.2 KiB
ObjectPascal

unit WebModuleU;
interface
uses System.SysUtils, System.Classes, Web.HTTPApp, MVCFramework, FireDAC.Stan.Intf,
FireDAC.Stan.Option,
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async,
FireDAC.Phys, Data.DB, FireDAC.Comp.Client;
type
TwmMain = class(TWebModule)
procedure WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModuleCreate(Sender: TObject);
private
MVC: TMVCEngine;
public
{ Public declarations }
end;
var
WebModuleClass: TComponentClass = TwmMain;
implementation
{$R *.dfm}
uses PeopleControllerU;
procedure TwmMain.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := '<html><heading/><body>Web Server Application</body></html>';
end;
procedure TwmMain.WebModuleCreate(Sender: TObject);
begin
MVC := TMVCEngine.Create(Self);
// required by the TMVCCacheController
MVC.Config['redis_connection_string'] := '127.0.0.1:6379';
MVC.AddController(TPeopleController);
end;
end.