[−][src]Struct async_graphql::CacheControl
Cache control values
Examples
use async_graphql::*; struct QueryRoot; #[Object(cache_control(max_age = 60))] impl QueryRoot { #[field(cache_control(max_age = 30))] async fn value1(&self) -> i32 { 0 } #[field(cache_control(private))] async fn value2(&self) -> i32 { 0 } } #[async_std::main] async fn main() { let schema = Schema::new(QueryRoot, EmptyMutation, EmptySubscription); assert_eq!(schema.execute("{ value1 }").await.unwrap().cache_control, CacheControl { public: true, max_age: 30 }); assert_eq!(schema.execute("{ value2 }").await.unwrap().cache_control, CacheControl { public: false, max_age: 60 }); assert_eq!(schema.execute("{ value1 value2 }").await.unwrap().cache_control, CacheControl { public: false, max_age: 30 }); }
Fields
public: bool
Scope is public, default is true
max_age: usize
Cache max age, default is 0.
Implementations
impl CacheControl
[src][−]
Trait Implementations
impl Clone for CacheControl
[src][+]
impl Copy for CacheControl
[src]
impl Debug for CacheControl
[src][+]
impl Default for CacheControl
[src][+]
impl Eq for CacheControl
[src]
impl PartialEq<CacheControl> for CacheControl
[src][+]
impl StructuralEq for CacheControl
[src]
impl StructuralPartialEq for CacheControl
[src]
Auto Trait Implementations
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnwindSafe for CacheControl
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src][+]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,