Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300822

Time based cache does not work as expected for anonymous users

$
0
0

Problem/Motivation

In a module, I'm trying to configure time based access restriction so I use a _custom_access callback in which I return an AccessResult object on which I apply setCacheMaxAge(60) to ensure that access is checked once per minute.

The problem is that this access check never expires for anonymous users - even if I set the page cache max age to 60 seconds too.
Logged in users do not have the same issue.

The same problem occurs with page content.

I created a quick gist to illustrate : https://gist.github.com/DuaelFr/7a11327b8a5acaa5da30

Steps to reproduce

  1. install Drupal standard
  2. create a tiny module like shown in the gist above
  3. navigate to /test as anonymous
  4. wait between 61 and 119 seconds
  5. reload the page

Expected result :
Something changed

Current result :
Nothing changed

Proposed resolution

No idea.

Remaining tasks

Find out what's going on. Fix it.

User interface changes

None.

API changes

None.

Data model changes

None.


Viewing all articles
Browse latest Browse all 300822

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>