Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Views has a setting for 'Disable views data caching' which can prevent Views data being cached.
I propose adding a similar setting that allows for any caching plugins to be disabled (for use when testing or developing locally, for example).
Original bug report:
Setting 'Disable views data caching' on admin/structure/views/settings/advanced doesn't actually disable Views caching because views_plugin_cache
uses cache_get()
instead of the wrapped views_cache_get()
(which checks the views_skip_cache
variable).
Comment | File | Size | Author |
---|---|---|---|
#6 | views-cache-disable-2202131-6.patch | 1.42 KB | justanothermark |
Comments
Comment #1
justanothermark CreditAttribution: justanothermark commentedPatch to fix. Note: bug was found & this tested with views_plugin_cache_time.
Had to add an $expire parameter to views_cache_set so that we didn't lose any existing behaviour.
Also added $bin parameter to cache_get/set for completeness in wrapping cache_set but would be happy for that change to be taken out if it's preferable to put everything from views_cache_set into the 'cache_views' bin.
Defaults provided for both parameters so that all existing code will continue to work as it always did.
Comment #2
justanothermark CreditAttribution: justanothermark commentedComment #5
justanothermark CreditAttribution: justanothermark commentedMissed the $use_language parameter form views_cache_set() calls.
Comment #6
justanothermark CreditAttribution: justanothermark commentedAfter offline discussions I have realised that the 'Disable views data caching' is for the data Views uses for processing & not the results of Views queries.
Therefore, I have updated the issue & patch to a feature request of a new setting to prevent any cache plugin from caching data or output. The patch works by adding a setting to the advanced settings page and checking this before Views loads the caching plugin on a view (in the same way that the live preview avoids caching).
Comment #7
renatogHi how are you
Ths idea is perfect. But in VIews for D7 the Team using for only fixes and new features are in Drupal 8.
I recommend that you create your project for DO.
Comment #8
renatog