Skip to main content

fraiseql_core/cache/
relay_cache.rs

1//! `RelayDatabaseAdapter` impl for `CachedDatabaseAdapter`.
2//!
3//! Relay pagination results are not cached — all calls are forwarded
4//! directly to the underlying adapter.
5
6use super::adapter::CachedDatabaseAdapter;
7use crate::{
8    db::{DatabaseAdapter, RelayDatabaseAdapter},
9    error::Result,
10};
11
12impl<A: RelayDatabaseAdapter + DatabaseAdapter> RelayDatabaseAdapter for CachedDatabaseAdapter<A> {
13    async fn execute_relay_page(
14        &self,
15        view: &str,
16        cursor_column: &str,
17        after: Option<crate::db::traits::CursorValue>,
18        before: Option<crate::db::traits::CursorValue>,
19        limit: u32,
20        forward: bool,
21        where_clause: Option<&crate::db::where_clause::WhereClause>,
22        order_by: Option<&[crate::compiler::aggregation::OrderByClause]>,
23        include_total_count: bool,
24    ) -> Result<crate::db::traits::RelayPageResult> {
25        // Relay pagination results are not cached — always delegate to the underlying adapter
26        self.adapter
27            .execute_relay_page(
28                view,
29                cursor_column,
30                after,
31                before,
32                limit,
33                forward,
34                where_clause,
35                order_by,
36                include_total_count,
37            )
38            .await
39    }
40}