Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cache specific resolver results #839

Answered by mcollina
ziimakc asked this question in Q&A
Discussion options

I would like to skip heavy count operations for pagination results, for example total count of users, as it's doesn't need to be accurate. Currently I do it manually, but is it possible to cache it with mercurius? mercurius-js/cache seems to work only for queries.

 UsersConnection: {
 total: async () => db.users.count() // cache this for some time?
}
You must be logged in to vote

it works only for queries. You'll need to use https://github.com/mcollina/async-cache-dedupe directly.

Replies: 1 comment

Comment options

it works only for queries. You'll need to use https://github.com/mcollina/async-cache-dedupe directly.

You must be logged in to vote
0 replies
Answer selected by ziimakc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /