Expand my Community achievements bar.

SOLVED

How to configure Dispatcher to cache persisted query requests?

Avatar

Level 3

According to the article [link], "Persisted queries are recommended as they can be cached at the Dispatcher and Content Delivery Network (CDN) layers", but I am struggling to find information on how to configure the Dispatcher cache in this article. I have tried to follow [this] add allow rules in the /cache setting, but still find it not cached. And no files related to this query get generated in the dispatcher cache folder. (The dispatcher cache works well currently on page contents). 

Can anyone provide guidance on how to configure Dispatcher to cache persisted query requests? Any insights or resources on this topic would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 6

You need to add rule to dispatcher for caching.

To cache all use the following code in ams_publish_cache.any

## Default allow all items to cache
/0000 {
/glob "*"
/type "allow"
}
## Don't cache csrf login tokens
/0001 {
/glob "/libs/granite/csrf/token.json"
/type "deny"
}

 To cache specific url parameter use following code

/cache
{
/docroot "/path/to/docroot"
/rules
{
/0000
{
/type "allow"
/url "/content/*"
/cache
{
/enable "1"
/useFilesystem "0"
}
}
}
/cache
{
/docroot "/path/to/cache"
/type "file"
/urlparams "param1,param2"
}
}

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

You need to add rule to dispatcher for caching.

To cache all use the following code in ams_publish_cache.any

## Default allow all items to cache
/0000 {
/glob "*"
/type "allow"
}
## Don't cache csrf login tokens
/0001 {
/glob "/libs/granite/csrf/token.json"
/type "deny"
}

 To cache specific url parameter use following code

/cache
{
/docroot "/path/to/docroot"
/rules
{
/0000
{
/type "allow"
/url "/content/*"
/cache
{
/enable "1"
/useFilesystem "0"
}
}
}
/cache
{
/docroot "/path/to/cache"
/type "file"
/urlparams "param1,param2"
}
}