Problem/Motivation
We have the session
cache context in core, to vary something per session. A related, but far less specific and therefore better cacheable variant of that is to vary something per "session or not". (This is a boolean.)
We need this for BigPipe: #2469431-198: BigPipe for auth users: first send+render the cheap parts of the page, then the expensive parts.
A similar one is user
vs. user.is_super_user
: the former has many, many possible values, the second is a boolean.
Proposed resolution
Add session.exists
cache context.
Remaining tasks
Code.Test coverage.Review.RTBC.Commit.Update https://www.drupal.org/developing/api/8/cache/contexts.
User interface changes
None.
API changes
API addition: new session.exists
cache context.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | session_exists_cache_context-2671988-2.patch | 7.23 KB | Wim Leers |
Comments
Comment #2
Wim LeersLifted this from the https://www.drupal.org/project/big_pipe module.
Test coverage was added at #2671958: SessionExistsCacheContext test coverage.
Comment #3
Wim LeersComment #4
Wim LeersNit: missing a space.
(I'll fix this after others have reviewed this, or a committer could also fix this on commit.
Comment #5
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedRTBC - Looks great to me :)
Comment #7
catchI wasn't sure about the naming here, but all the other options are worse (like HasSession etc.). Committed/pushed to 8.1.x, thanks!
Comment #8
Wim LeersDid https://www.drupal.org/node/2459039/revisions/view/9158150/9416754.)
, now this issue is completely done. (Diff:Comment #9
alexpottVery very minor coding standard followup... #2675534: Fix 'Drupal.Commenting.FileComment' coding standard again
Comment #10
Wim LeersRTBC'd :)