Purge Cache
It's sometimes essential to purge cached responses, so Skylark includes a purgeCache
mutation to do that. However, to avoid purging the entire cache, arguments can be sent to the mutation to minimise the effect to response times.
Purge All
If you want to purge the entire cache, set the all
argument to true
.
mutation {
purgeCache(all: true) {
all
}
}
Purge Types
To purge all instances of a specific type, set the type
argument.
This example will purge all instances of the Episode
type from the cache. This includes Set
objects which include episodes in their response and responses which include episodes in their relationship responses.
mutation {
purgeCache(type: {name: Episode}) {
type
}
}
Purge Specific Objects
To minimise the effects of purging the cache, you can purge only specific objects.
Returning the UID in queries
In order for the cache to be built for specific objects, the uid must be returned in queries and mutations.
If this is not done it's impossible to purge by an object's UID.
You can purge an array of UIDs on a per type bases. For example:
mutation {
purgeCache(type: {
name: Episode,
uids: [
"01HD1SRJ8KD10WVXZQ4WDHKSAA",
"01HD1SSTHX60X7YBPMXDRBEV0W",
"01HD3WJ7ST00HC9TV04HNG17QV"
]
}) {
type
uids
}
}
Updated 7 months ago