Skip to content

Commit

Permalink
D7 Configurable tag overriding (#29)
Browse files Browse the repository at this point in the history
* Update pantheon_advanced_page_cache.module

* Update pantheon_advanced_page_cache.module

* Update config.yml

* Update config.yml

* install twice

* Adding install hook

* Update pantheon_advanced_page_cache.install

* readme update

* Update README.md
  • Loading branch information
stevector authored Jan 4, 2021
1 parent 15a9d72 commit 845f215
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
name: Set up site
command: |
terminus connection:set ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} sftp
terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- site-install -y
# try installing twice to avoid inconsistent errors on site-install.
terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- site-install -y || terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- site-install -y
terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- dl views -y
terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- en views -y
terminus drush ${TERMINUS_SITE}.${CIRCLE_BUILD_NUM} -- views-enable frontpage
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ This module caps the `Surrogate-Key` at 25,000 bytes to minimize the chances tha
This limit can be reached if your site renders thousands of entities in a single response.
You will see warning messages in your log directing you to [the issue queue](https://www.drupal.org/project/pantheon_advanced_page_cache/issues/2973861) if this limit is reached.

## Changing Listing Tags

Prior to the 1.2 release, this module would change the cache tags used on default listings.
This changing of was done to make cache hits more likely but resulted in [confusing cache clearing behavior](https://www.drupal.org/project/pantheon_advanced_page_cache/issues/2944229).
Sites that installed this module prior to 1.1 should uninstall and reinstall or run this command to update their settings.

```
terminus drush [MACHINE-NAME-OF-SITE].[ENV-NAME] -- vset pantheon_advanced_page_cache_override_list_tags FALSE
```

## Feedback and collaboration

For real time discussion of the module find Pantheon developers in our [Power Users Slack channel](https://pantheon.io/docs/power-users/). Bug reports and feature requests should be posted in [the drupal.org issue queue.](https://www.drupal.org/project/issues/pantheon_advanced_page_cache?categories=All) For code changes, please submit pull requests against the [GitHub repository](https://github.com/pantheon-systems/pantheon_advanced_page_cache) rather than posting patches to drupal.org.
13 changes: 13 additions & 0 deletions pantheon_advanced_page_cache.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* @file
* Contains install function for Pantheon Advanced Page Cache.
*/

/**
* Implements hook_install().
*/
function pantheon_advanced_page_cache_install() {
variable_set('pantheon_advanced_page_cache_override_list_tags', FALSE);
}
6 changes: 4 additions & 2 deletions pantheon_advanced_page_cache.module
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
function pantheon_advanced_page_cache_pre_emit_cache_tags_alter(&$tags) {
// Rename all _list cache tags to _emit_list to avoid clearing list tags by
// default.
foreach ($tags as $key => $tag) {
$tags[$key] = str_replace('_list', '_emit_list', $tag);
if (variable_get('pantheon_advanced_page_cache_override_list_tags', TRUE)) {
foreach ($tags as $key => $tag) {
$tags[$key] = str_replace('_list', '_emit_list', $tag);
}
}
}

Expand Down

0 comments on commit 845f215

Please sign in to comment.