add `policy.key` option
simone-sanfratello opened this issue · comments
Simone Sanfratello commented
add option to define a custom serialize function for any policy, or one for all, for example
const schema = `
type Query {
add(x: Int, y: Int): Int
}
`
// ...
app.register(cache, {
ttl: 10,
policy: {
Query: {
add: {
key: ({ fields, self, args, info, context }) => `x:${args.x}-y:${args.y}`
}
}
})
note: extendKey
option is ignored, should be thrown an error on policy validation if key
and extendKey
are both used