query @cacheControl(maxAge: 15){
queryReview(filter: { comment: {alloftext: "Fantastic"}}) {
comment
by {
username
}
about {
name
}
}
}
https://dgraph.io/docs/graphql/queries/cached-results/#
Hi we have that awesome feature in graphql. But what about DQL? Can I use that feature in DQL too?
Because it is quite important. E.g I want to do this (because this is not currently supported in GraphQL)
query {
post1 as var(func:type(Author)) @cascade {
Author.posts : Author.posts @filter(eq(Post.title, "Dgraph")){
uid
}
}
queryAuthor(func: type(Author)) @filter(eq(Author.name,"Alice") or uid(post1)){
Author.name : Author.name
Author.posts : Author.posts {
Post.title : Post.title
Post.text : Post.text
dgraph.uid : uid
}
dgraph.uid : uid
}
}
So, many users might search for Posts with Dgraph as the title. But only a few people might search for Posts with Alice as the Author. What I want to do to save resources:
query @cacheControl(maxAge: 15) {
post1 as var(func:type(Author)) @cascade {
Author.posts : Author.posts @filter(eq(Post.title, "Dgraph")){
uid
}
}
queryAuthor(func: type(Author)) @filter(eq(Author.name,"Alice") or uid(post1)){
Author.name : Author.name
Author.posts : Author.posts {
Post.title : Post.title
Post.text : Post.text
dgraph.uid : uid
}
dgraph.uid : uid
}
}
Is this possible? If No, are the smartest roundabouts to achieve that? I could do the first query from my server client with graphql, and then do the second DQL client, but then I would have big increased latency because client -> dgraph -> client -> dgraph -> client
and I want to achieve client -> dgraph -> client