从 Aqueduct 应用程序获取上次修改日期时间的最轻量级方法是什么?

What is the most lightweight way to get last modified datetime from an Aqueduct application?

我正在编写一个非常小的 REST API 使用 Dart/Aqueduct 在 Heroku 上使用 PostgreSQL 托管。

与此 API 通信时,我需要获取所有数据并将其存储在本地应用程序中。应用程序将在重新启动时询问 API 是否有任何数据库中的任何数据已更改,这些数据只会通过此 API 进行修改。

我的问题是:如何查看数据是否被修改?将它存储在 Aqueduct 通道中是不可行的,因为 Heroku 将根据需要启动服务器(并同时启动多个服务器)每次更改此修改后的日期时间。

PostgreSQL 无法提供这个修改后的日期时间(https://dba.stackexchange.com/questions/58214/getting-last-modification-date-of-a-postgresql-database-table) - so what do I do? Is the only way to do this to have a seperate table storing this information? Can this be done more lightweight, so I wouldn't have to make a query to the databases when e.g. calling https://my-api.com/lastModified?我应该提供一个静态文件,每次数据修改时都应该写入该文件吗?

也许存在一个智能、轻量级的解决方案! 干杯:)

是的,使用单独的 table 来存储日期 - ORM 已经这样做来跟踪迁移。我不确定在这种情况下轻量化意味着什么,但是您不会 运行 使用这种方法遇到任何问题,而文件或 in-memory 存储根本不起作用。