You are not logged in.
Pages: 1
Hi forum members,
I am using Mormot framework with an external MySQL database. I have a very small table
which never changes. So I am trying to activate table cache for this particular table with the
following code:
aetRestServerDB := TSQLRestServerDB.Create(aetDBSchema, ':memory:', false);
aetRestServerDB.CreateMissingTables(0);
aetRestServerDB.Cache.SetCache(TSQLDriveRecord);
Then I retrieve the contents of this external table directly in JSON format, via the SOA method as follows:
procedure TMyRestServer.mysql_test(Ctxt: TSQLRestServerURIContext);
begin
// ALTERNATIVE 1
Ctxt.Returns(aetRestServerDB.RetrieveListJSON(TSQLDriveRecord,'',''));
// ALTERNATIVE 2
//Ctxt.Returns(VariantSaveJson(aetRestServerDB.RetrieveDocVariantArray(TSQLDriveRecord,'','')));
end;
Whether I activate the cache or not, when I benchmark the above method with ab, I always get around 4,000 req/s (with both ALTERNATIVE 1 and 2).
Therefore the cache seems not working. Is there another method to retrieve all the records at once in JSON from the cache?
Please note that the table I would like to cache is an external table.
Thanks in advance.
Offline
The cache is for individual records, i.e. for lookup by ID, not for lists.
It is clearly stated by the documentation.
Then there is a cache at SQLite3 level, but there is no cache for direct external DB access, with no virtual table.
Online
Pages: 1