This appears to be a bug in CF10.
I'm just getting a portable repro case sorted out, and will report back.
I've had more of a dig into this and documented my findings here: http://adamcameroncoldfusion.blogspot.co.uk/2012/10/probably-backwards-compat-bug-in-cf10s .html
Bottom line is that CF10 has changed behaviour here. I think it constitutes a backwards compat bug, but I think it's gotta be consigned to "well we learn something every day" rather than expecting them to change it?
Thanks you very much for you reply.
We are still trying different things, and noticed that we overlooked a very important detail: by default, CF10 uses Ehcache to cache queries, so in fact we were using Ehcache without knowing it (yes, I read the documentation, yes, I didn't understand it correctly, I thought that you can activate Ehcache as an option). We have checked the "Use internal cache to store queries" option in the Caching server settings, and after a reboot, now it seems to work as expected.
So, now, the problem seems to be (at least in our production server) that Ehcache default scope is application, not server, as one can think reading the docs. I understand that for new deployments that's not an issue, but when migrating websites with more than one application defined that use common queries, that's a bit tricky to find.
As well as making the setting in CFAdmin, one can also do it in Application.cfc:
<cfset this.cache.useinternalquerycache = true>
That is not the default, but it sets it back to work how previous versions of CF worked.
Thanks again for your time on this, Adam.
Yes, in fact I had read that page in the docs, but, I'm not sure why, I supossed that Ehcache was an option, and that by default the cache mechanism will be the old one. Also, it's not clear (not for me, at least) what is the default scope for Ehcache. I understood that it was server, but it seems to be application. I'm interested in using Ehcache, so I'll dive on the docs to look for how to change that, if possible...
Rob Brooks-Bilson very kindly point me to the correct way to achieve what I wanna do with Ehcache, in just two steps:
1- define a custom cache region. I did that in both my Application.cfc files:
<cfset cacheName = "customQueryCache">
<cfif NOT cacheRegionExists('#cacheName#')>
2- assign an unique Id to every cached query, in that region:
<cfquery name="articleList" datasource="c7_noticiasonline" cacheRegion="customQueryCache" cacheID="qAllArticles" cachedwithin="#CreateTimeSpan(0, 0, cache, 0)#">
As I usually need a cached query for every item in the table, in that cases I named the queries with the database item key:
<cfquery name="article" datasource="c7_noticiasonline" cacheRegion="customQueryCache" cacheID="qNewsDetail#IdArticle#" cachedwithin="#CreateTimeSpan(0, 0, cache, 0)#">
Defining the caches and querys in that way, I can access any cached query from any application on our website, using its region and Id.
As a bonus, in the admin section on our website, instead of calling a query with CreateTimeSpan(0, 0, 0, 0) to clear the cache, now we use cacheRemove(). More elegant, and one database hit saved.
Thanks you all for your help.