Skip to content

Add Auto Expiry Feature - #111

Merged
colinmollenhour merged 6 commits into
colinmollenhour:masterfrom
mpchadwick:ee-pagecache-workaround
Oct 3, 2016
Merged

colinmollenhour merged 6 commits into
colinmollenhour:masterfrom
mpchadwick:ee-pagecache-workaround

Conversation

@mpchadwick

Copy link
Copy Markdown
Contributor

Implementation of feature discussed in #110.

* @return int Cache life time
*/
protected function _getAutoExpiringLifetime($lifetime, $id)
{

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to check if it matches the pattern if the feature is disabled. I recommend short-circuiting by changing this to:

 if ($lifetime || ! $this->_autoExpireLifetime) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Done.


return !empty($matches);
}

@colinmollenhour colinmollenhour Oct 1, 2016 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other options are not exposed this way... Is there a reason they need to be set aside from the constructor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I added the setters was to be able to change the properties for testAutoExpiry. Maybe there's a better way, but I'm not sure. I tried Googling to see if setUp could tell what test method as being called, but couldn't find any information about that.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the proper way would be to have a new test case class for these tests that require a different setUp method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colinmollenhour Updated with a separate test case. I'm following the pattern introduced with forceStandalone where a protected property is used and can be changed in the new test case class. Happy to squash these down as a final step if you'd like.

@colinmollenhour
colinmollenhour merged commit 155f4dc into colinmollenhour:master Oct 3, 2016
@colinmollenhour

Copy link
Copy Markdown
Owner

Looks good! Thanks, Max!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants