Aidbox
Search
K

ETAG support

Read more about How ETAG works!

ETag Cache

All ETag values are cached to make ETag queries efficient. If you somehow made this cache invalid, you can reset Aidbox ETag cache by DELETE /$etags-cache or DELETE /Patient/$etags-cache.
Aidbox ETags mechanisms is based on txid column of resource table in database! If you update resources in database, don't forget to update the txid column and reset cache. UPDATE resource SET txid = nextval('transaction_id_seq')

ETag Cache performance

To build a cache for a specific resourceType ETag Aidbox runs a query to get the max value of the txid column. To make this operation efficient, it's recommended to build an index on the txid column for tables where ETag will be used.
Use query:
CREATE INDEX IF NOT EXISTS <resourceType>_txid_btree ON <resourceType> using btree(txid);
CREATE INDEX IF NOT EXISTS <resourceType>_history_txid_btree ON <resourceType>_history using btree(txid);
replace with table name, for example CREATE INDEX IF NOT EXISTS patient_txid_btree ON patient using btree(txid); CREATE INDEX IF NOT EXISTS patient_history_txid_btree ON patient_history using btree(txid);