Closed (fixed)
Project:
Authenticated User Page Caching (Authcache)
Version:
7.x-2.0-beta7
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
20 Jan 2016 at 13:18 UTC
Updated:
9 Feb 2016 at 10:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
znerol commentedWhat is triggering the the Ajax action? Is it controlled by a page element which is inside or outside the fragment in question? Is it controlled by some other means (e.g. a timer)?
Comment #3
alanburke commentedAnother piece of js will trigger the update.
It is outside of the fragments to be updated.
It will send a json request, which will mean that the fragment contents should be invalidated, and ideally refreshed.
Comment #4
znerol commentedThere is no "official" support for that use case in authcache. You might be able to work around that in the following way:
$('<span class="authcache-ajax-frag" data-p13n-frag="block/commerce_cart-cart"></span>')Drupal.attachBehaviors()on the parent node.Comment #5
alanburke commentedSo that all works really well, except the the URL response is cached in authcache_ajax.js.
So I just need a way to clear that cache, or avoid it being set in the first place.
Comment #6
alanburke commentedIs there any way to address that cache object from another js file?
So I could clear it, before calling Drupal.attachBehaviors()?
Comment #7
znerol commentedCall
authcache_p13n_session_invalidate()as part of your Ajax callback. This will result in the cache busting cookie (aucp13n) being set to a new random value.Comment #8
znerol commentedOh, wait. There is a static cache in
authcache_ajax.js. So the cache busting cookie will not help.Comment #9
znerol commentedConsider the following function (taken from
authcache_ajax.js):I guess it would be possible to make your use-case work if the
vparameter would be added to the URL before checking the static cache.Comment #10
alanburke commentedI don't think so.
The cache key doesn't use the
vparameter.What If I reworked it so that the cache was part of the
Drupalobject.Then I could address it from elsewhere.
Would a patch that does that be considered?
Comment #11
znerol commentedYes, that's what I tried to express above, and yes, patches are welcome :)
Comment #12
alanburke commentedComment #13
znerol commentedIf cache-busting does not affect the static cache, then this could be considered a bug. How about just nuking the cache if the cache-busting cookie changed in the meantime?
Comment #15
alanburke commentedComment #17
alanburke commentedNot sure what the fail means? Any clues?
Comment #18
znerol commentedThe test fail is not related to this patch. I've seen that before in other issues. Although very strange that the branch tests is not affected.
As for the patch, I'd prefer something which does not leak internals. I'd like to avoid that future changes to the static cache will break existing sites. Can you take a look at #13 and report back whether it addresses your use-case?
Comment #19
alanburke commentedI had missed that patch - that works for my use case.
I set the cookie to a new random value, and this invalidates the cache.
So that works for me
Comment #21
znerol commentedCommitted #13. Thank you for reporting this issue and for actively working on a solution.
Comment #22
znerol commentedComment #24
gunwald commentedCould someone point out please, what the JS would look like, to manually reload/refresh a block. As an non pro I found the authcache_ajax.js very hard to read.