-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDST-213: Adjust caching for embargo and related access control. #39
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,8 @@ | |
* "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider" | ||
* }, | ||
* }, | ||
* list_cache_tags = { "node_list", "media_list", "file_list" }, | ||
* list_cache_contexts = { "ip.embargo_range", "user" }, | ||
* list_cache_tags = { "embargo_list", "embargo_ip_range_list" }, | ||
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have come to realize: Except for Having the To deal with specific user exemptions, might get into the situation of:
Gonna give it something of a look... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have improvements to caching in #40 |
||
* base_table = "embargo", | ||
* admin_permission = "administer embargo", | ||
* entity_keys = { | ||
|
@@ -451,4 +452,18 @@ public function ipIsExempt(string $ip): bool { | |
return $exempt_ips && $exempt_ips->withinRanges($ip); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getListCacheTagsToInvalidate() : array { | ||
return array_merge( | ||
parent::getListCacheTagsToInvalidate(), | ||
[ | ||
'node_list', | ||
'media_list', | ||
'file_list', | ||
] | ||
); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per Drupal's
EntityTypeInterface::getListCacheTags()
, which should be:Really could leave unset, as the default is
embargo_list
, but whatever, we can set explicitly.Thinking this was originally set as it was in a misguided attempt to have the effects of the embargo applied immediately, but this fits more inline with
::getListCacheTagsToInvalidate()
, which is used when invalidating cache tags on entity save/delete, instead of providing the tags/contexts to set where listing of the given embargo entities are used, such as when calculating the access control results.