The check_markup function has a one day expiration hard-coded:
cache_set($id, 'cache_filter', $text, time() + (60 * 60 * 24));
rather than using the system's cache lifetime value:
cache_set($id, 'cache_filter', $text, time() + variable_get('cache_lifetime', 86400);
I searched and could not find out why. This seems inconsistent.
Comment | File | Size | Author |
---|---|---|---|
#37 | check_markup_d6.patch | 626 bytes | catch |
#31 | drupal8.filter-cache.31.patch | 763 bytes | sun |
#24 | filter_check_markup_7.patch | 999 bytes | dawehner |
#22 | filter_check_markup_6.patch | 18.7 KB | dawehner |
#19 | filter_check_markup_5.patch | 908 bytes | ainigma32 |
Comments
Comment #1
ricabrantes CreditAttribution: ricabrantes commentedNo activity, Close..
Comment #2
NancyDruWhat activity do you want? I'd like to see someone explain this.
Comment #3
ainigma32 CreditAttribution: ainigma32 commentedDid you ever get an answer? I can see it's still in HEAD.
- Arie
Comment #4
NancyDruNo; it would seem that the only way to get this addressed is to submit a patch.
Comment #5
ainigma32 CreditAttribution: ainigma32 commentedThat sounds like a challenge ;-)
Patch attached. Let's see what people think.
- Arie
Comment #6
ainigma32 CreditAttribution: ainigma32 commentedStill not much attention. Setting to bug report as this arguably is a bug.
- Arie
Comment #7
ainigma32 CreditAttribution: ainigma32 commented@NancyDru: Could you test this patch against HEAD so it can be set to RTBC ?
- Arie
Comment #8
NancyDruI will have to do some tweaking. My D7 test site is built with a -dev version a few days old, so I will have to do a checkout, I guess. The code looks right.
Comment #9
dawehnerits make total sense, i also had the issue when writing a filter, that setting cache_lifetime didn't changed anything
BUT
every code in core uses cache_lifetime with default_value: 0
Here is the result of running the tests:
8138 passes, 0 fails, and 0 exceptions
Comment #10
dawehnerhere is the patch
Comment #11
Dries CreditAttribution: Dries commentedThings that are run through check_markup should always be cached because we can always cache them -- there is no harm.
This patch can result in severe performance losses.
Comment #12
dawehnerso here is a current patch with a default of 86400s
Comment #14
ainigma32 CreditAttribution: ainigma32 commentedOK back to the original patch (rerolled) to get this issue moving again.
- Arie
Comment #15
ainigma32 CreditAttribution: ainigma32 commentedAdded a comma to the comment (yes really) :-) per discussion with dereine on IRC.
- Arie
Comment #16
dawehneri used this method of cache lifetime and replacing 24*60*60 with the calculated value 86400
hey you also removed the s from days ^^
Comment #17
sun...should rather use "default" here. Also, no need to repeat "expiration". And, additionally, comments need to wrap at 80 chars.
Please revert to 60 * 60 * 24 instead of 86400. If we are going to change this, then we will change this everywhere in core (in a separate issue); changing it just here means inconcistency == bad.
Comment #18
sunComment #19
ainigma32 CreditAttribution: ainigma32 commentedRerolled and modified per #17
- Arie
Comment #20
ainigma32 CreditAttribution: ainigma32 commentedCould have sworn I set this...
- Arie
Comment #22
dawehnerrerole
Comment #23
cburschkaChanged files:
I'm sure you didn't mean to eat a kitten. :P
Comment #24
dawehneruh
thats strange :)
Comment #26
gpk CreditAttribution: gpk commentedThe cache_lifetime variable is widely misunderstood. Possibly including by me. I think of it as the delay until temporary/expired entries will actually be removed from the cache, once a cache wipe of such entries has been requested. AFAIK it was not intented to be used as suggested here.
Comment #27
NancyDruWell, this one use is inconsistent with others, so maybe the core developers misunderstand it too?
Comment #28
gpk CreditAttribution: gpk commentedQuite possibly :P (http://drupal.org/node/227228#comment-1501876).
In that related issue #227228: cache_clear_all and cache_get fail to clear caches when Minimum cache lifetime is on I suggested renaming it to cache_flush_delay: http://drupal.org/node/227228#comment-1278550. Never got round to it at the time; maybe it is time to do that now!
Comment #29
gpk CreditAttribution: gpk commentedAnd more ... #256416: Editing a node does not wipe its cache entry
Comment #30
catchThis should never be set to the value of cache_lifetime.
However it's also a bit senseless to hard code this to one day. I would make it a variable (with no user interface for it), defaulting to around 2-3 weeks so that entries that are never going to be used can be expired from the database cache, but we're not recreating the same caches over and over again on sites with a lot of content.
Comment #31
sunMeanwhile, I think this is fundamentally flawed.
A minimum cache expiration time does not really make any sense at all. The filtered text either changes or it does not. If it doesn't then there's no reason for flushing the cache.
The filtered text can only change when
Comment #32
catchI was thinking we might want some garbage collection here, but that should be handled by full cache clears, or using a cache backend like memcache that does LRU. It's not much different to any other cache in Drupal on that front and you'd need a lot of content to run into issues - by that time you'll be running into the same issue elsewhere.
Filters can declare themselves uncacheable, so that is already handled (and 24 hours is arbitrary anyway).
RTBC.
Comment #33
xjmTagging issues not yet using summary template.
Comment #34
Dries CreditAttribution: Dries commentedGood catch, and might actually yield a small performance improvement.
Committed to 7.x and 8.x.
Comment #36
crea CreditAttribution: crea commentedThe performance improvement here is not "small". Majority of search engine traffic is from low frequency keywords hitting rarely accessed pages. So for most of these visits the filter cache is missing and visitor experiences slow page generation time.
The patch from sun makes total sense and the pre-patch behavior was simply dumb.
Comment #37
catchThis was never backported to D6. Was looking at performance issues on a site being very, very heavily crawled, and rebuilding the filter cache was taking a lot of time in a lot of pages.
Comment #38
sunWe should take over and backport the inline comment from #31, too.
The @see can be replaced with filter_admin_format_form_submit()
With that, the backport totally is RTBC (I just double-checked a couple of cache and filter functions for their D6 behavior).