Problem/Motivation
The file admin view is cached incorrectly because the file_usage table is just attached data to the file entities and the view is cached by tags. Tags are only available for file entities. We need to be able to add an additional tag to the view in \Drupal\file\FileViewsData::getViewsData() that we can clear when the file usage is updated. See #2810397: File usage view is cached and doesn't reflect real state for specific information of the file usage problem.
This is categorised as bug because without a fix along these lines it is impossible to ensure that caching works properly on views which use tag based caching and join to tables that are not entity based.
Proposed resolution
- Allow views base tables to define view cache tags.
- Allow views base tables to define view cache max age.
- Use that information when caching a view
Remaining tasks
Update tests
Code review
User interface changes
None
API changes
Add support for declaring tags, max age and fix context in views data.