Problem/Motivation

The docs for Drupal\views\Plugin\views\cache\CachePluginBase::cacheSetMaxAge() say:

> * Determine cache expiration time.

and there is no @return documentation.

This makes it look like the function returns the expiry time value to be put into the cache.

However, looking at cacheSet() in the same class, we can see it expects a relative offset from the request time:

        $expire = ($this->cacheSetMaxAge($type) === Cache::PERMANENT) ? Cache::PERMANENT : (int) $this->view->getRequest()->server->get('REQUEST_TIME') + $this->cacheSetMaxAge($type);

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#10 3480732-nr-bot.txt1.93 KBneeds-review-queue-bot

Issue fork drupal-3480732

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    2 hidden branches
  • 3480732 Comparechanges, plain diff MR !9858
  • 11.x Comparecompare

Comments

joachim created an issue. See original summary.

debrup’s picture

Assigned: Unassigned » debrup

Working on it.

debrup’s picture

Hi @joachim,
I've opened the MR, Please have a look:)
Thanks!

joachim’s picture

Status: Active » Needs work

Thanks for the MR! Though remember to change the status to Needs Review when you want it looked at.

I've left comments on the MR for changes.

debrup changed the visibility of the branch 11.x to hidden.

debrup’s picture

Status: Needs work » Needs review
debrup’s picture

Status: Needs review » Needs work
debrup’s picture

Status: Needs work » Needs review

Hello @joachim, please let me know if the changes are alright.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.93 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

debrup’s picture

Status: Needs work » Needs review

Hello @joachim, please review the changes.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

quietone’s picture

Status: Reviewed & tested by the community » Needs work

@debrup, thanks for staying with this!

One suggestion in the MR that needs to be considered.

debrup’s picture

Hello @joachim,
'Defaults to' has been used all across the codebase in similar situations, even in methods present in various Interfaces. I think it will be beneficial to maintain the same format used as it will be easier to understand by others. Plus since we are wanting to do the job of an interface so following the common interface format will not do any harm:)

debrup’s picture

Status: Needs work » Needs review

Hello @joachim @quietone, Please review the changes.

debrup’s picture

Assigned: debrup » Unassigned
debrup’s picture

@joachim @quietone please review the changes.

gaurav gupta’s picture

Status: Needs review » Reviewed & tested by the community

The changes has been done as per the suggestions in #13.
Moving it to RTBC.
Thanks.

quietone’s picture

Title: incorrect & incomplete docs for CachePluginBase::cacheSetMaxAge() » Correct docs for CachePluginBase::cacheSetMaxAge()

  • quietone committed ab4a2c7e on 11.1.x
    Issue #3480732 by debrup, joachim, gaurav gupta: Correct docs for...

  • quietone committed 4f04d687 on 11.x
    Issue #3480732 by debrup, joachim, gaurav gupta: Correct docs for...

quietone’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed to 11.x and cherry-picked to 11.1.x only, here were conflicts in the phpstan baseline for other branches.

Thanks for improving the documentation in core!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.