Skip to content

Commit

Permalink
Improved tryfindsessionbyid using count instead of loading full object
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Jan 26, 2025
1 parent c46ee5c commit aca41b3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions sources/MVCFramework.Session.Database.pas
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,9 @@ procedure TMVCWebSessionDatabaseFactory.TryDeleteSessionID(const ASessionID: Str
end;

function TMVCWebSessionDatabaseFactory.TryFindSessionID(const aSessionID: String): Boolean;
var
lSess: TMVCSessionActiveRecord;
begin
inherited;
lSess := TMVCActiveRecord.SelectOneByRQL<TMVCSessionActiveRecord>(Format('eq(session_id, "%s")', [aSessionID]), False);
try
Result := Assigned(lSess);
finally
lSess.Free;
end;
Result := TMVCActiveRecord.Count<TMVCSessionActiveRecord>(Format('eq(session_id, "%s")', [aSessionID])) = 1;
end;


Expand Down

0 comments on commit aca41b3

Please sign in to comment.