Subtitle: yet another example of why Drupal's cache implementation sucks (or, at minimum, is badly documented).
The way you are using caching of a 'negative response', you really want it to be flushed in 10 minutes. Well guess what: the DrupalDatabaseCache class doesn't always do that. (cache_get() deletes entries with a past 'expiry' property, only if the site has set a 'minimum cache lifetime', as in admin/config/development/performance)
Therefore your module must make sure that negative responses are not cached.
(I could have made the patch so it makes sure that actual/valid lists of banks are also guaranteed to expire after the set 86400 seconds... but that didn't seem so important. And this way there is no behavior change in production-mode sites.)
| Comment | File | Size | Author |
|---|---|---|---|
| ideal-negativecaching.patch | 1.07 KB | roderik |
Comments
Comment #1
xanoI haven't tried the patch yet, but I understand how you're trying to solve the issue. However, I believe this still doesn't fully solve the problem: after ten minutes, the API should perform a new directory request, regardless of the cached data. Because the patch does not only check the cached data's expiration date, but also checks the actual data, it does not invalidate the cache item if the data is valid, but expired.
We can easily work around that too (just delete the part that checks the data itself), but I'm very much inclined to see if we can't fix this issue in core instead. If that's not possible, we'll add a workaround to iDEAL API.
Just a note: this is not a bug in core, nor is it badly documented (see cache_get:7). Instead, iDEAL implements the cache wrongly.
Comment #2
roderik1) Yes the patch does solve the problem at hand, because if the data is valid (but expired) then the problem at hand does not apply.
2) This is what I pointed out in my last paragraph: you can delete the checks on the actual data if you want. (In case you want to make sure that lists of valid banks are only cached for a minimum time period. That's your decision, as far as I'm concerned. By the way, in that case the expiry time is not 10 minutes but 1 day. But that's detail.)
I thought my bugreport was clear enough in implying that, wasn't it?
---
Fix what, and how? You don't give a hint to what you mean and even say in the next line that there is neither a bug nor a hiatus in the documentation of the current behavior.
---
As a general remark, maybe it's just some kind of language/attitude barrier... but I just don't get how you expect bug reports to be followed up. I would try to cooperate usefully if I got it, but...
In the first part, you rephrase something I already said, but then portray it as a problem that I had not thought of. In the second part you say 'should be fixed elsewhere' but not why or how. Both have the effect of making me completely unsure of what to do now - and halting the path to a resolution. Saying the fix is wrong and/or the direction should be different is cool, but there's always a "BUT" following which takes away any concrete direction.
Same as a previous report.
If you bring suggested fixes to a halt because you don't want them... and prefer I just fork the module privately... that's fine. Just say so. It's less work than hashing out fixes in issue queues.
Comment #3
roderikOK, sorry for being snappy.
What remains, though, is that I have no idea what to do now to resolve this (or if we're even aiming to resolve this issue), until I know what this means:
(I'm hoping you are not waiting (for someone) to ask for Drupal Core to change the code and the specs of the current caching system, before allowing this fix in iDEAL API.)
Comment #4
xanoJust a short heads-up: I didn't mind your response and you raised some valid points. You'll definitely get a decent reply from me, but I've simply been to busy to properly deal with this issue (and more), which you can see in some of the mistakes I made earlier in this issue.
However, I will be at DrupalJam this Friday and if you'd like we can discuss this personally. You know what you're talking about and I have the feeling you're pretty interested in this whole thing; you might be interested in the presentation about Payment I'll be giving at DrupalJam.
Comment #5
roderikBeing busy happens to 100% of module maintainers. (Glad I'm not one, I just trawl random issue queues ;) )
Until that time, this issue is fine as a temporary fix for whoever encounters it... as long as it doesn't say "does not work" when in fact it does :p
Payment sounds nice! and I'd be interested in chatting about related stuff in person. I wish I could be there without giving up a full day for traveling back & forth, unfortunately I'm at too much of a distance to NL at the moment.
Comment #6
jawi commentedAre these issues solved yet?
Comment #7
roderik@Jawi: they are only solved after applying the patch, which is not in the -dev version yet.
@Xano: I am going to re-try asking questions to make this concrete.
1)
Do you still want to wait and (quoting #1) "see if we can't fix this issue in core instead"?
You have 2 options for an answer:
a) No (because I realise that the behavior of the D7 caching system -despite being confusing- actually works as specified, so I realize that nothing will get fixed.)
b) No (because even though I don't realize point a, I accept that such a behavior change will never be introduced in D7.)
:)
Seriously, I could hunt down issue numbers and other discussions for you, but I hope I don't have to. The caching system in D7 is braindead (in some aspects), but not broken. You'll need to work with the system as specified/documented.
2)
You mentioned that my patch does not "invalidate the cache item if the data is valid, but expired.". This is by design; it follows Drupal's standard caching behavior. IMHO Drupal's standard behavior is only a problem for the cached 'invalid' data.
But do you want this anyway?
a) yes, I do want to invalidate valid cached data immediately after 'expiry time' (which means treating my valid list of issuers differently from any other data in the {cache} table)
b) no, I realize that the caching system specifies a "minimum cache lifetime", and I don't mind treating my valid list of issuers just like any other data in the {cache} table
Comment #8
xano#2048495: Failed directory request is not cached (7.x-3.x) should fix this.
Comment #9
roderikOK. So in the linked issue, I see you implemented an equivalent of this original issue summary/patch, which is apparently considered valid for 2.x in hindsight.
So since noone is interested in 2,x anymore, I guess this issue can now die.....................
Comment #10
xano