#1 2021-05-24 11:19:46

wxinix
Member
Registered: 2020-09-07
Posts: 121

Would multiple TRestServerDB instances in one Process allowed?

Is it allowed to have multiple TRestServerDB instances in one Process?

The TRestServerDB instances are created using:

FServer := TRestServerDB.Create(FSQLModel, SQLITE_MEMORY_DATABASE_NAME, False, '');

Offline

#2 2021-05-24 11:47:19

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: Would multiple TRestServerDB instances in one Process allowed?

OK- it seems fine based on SQLite documentation:
https://www.sqlite.org/inmemorydb.html
"Opening two database connections each with the filename ":memory:" will create two independent in-memory databases."

Offline

#3 2021-05-24 17:11:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,350
Website

Re: Would multiple TRestServerDB instances in one Process allowed?

You can create as many TRestServerDB as you need.

And not only for in-memory databases, but also for files.
On a SaaS-like solution, I usually create a DB file per client organization, with a simple TRestServerDB cache for a few minutes. The idea is to have each organization having its own data folder. Easy to backup (or not), and move to another instance.

Offline

Board footer

Powered by FluxBB