userver icon indicating copy to clipboard operation
userver copied to clipboard

Allow specifying ORDER BY in PostgreSQL cache policies

Open apolukhin opened this issue 2 years ago • 0 comments
trafficstars

See https://userver.tech/d9/dde/pg_cache.html#pg_cc_cache_policy

We need a way to say

  // `Order by` clause of the query.
  //
  // Required: no
  static constexpr const char* kOrderBy = "id DESC, updated ASC";

The ORDER BY functionality is useful when we have a table that stores all the events with some updated timestamp, but in cache we wish to store only the last event. To do that we need a guarantee on order of insert_or_assign calls

Tests also required

Internal ticket: 3248

apolukhin avatar Oct 25 '23 15:10 apolukhin