Skip navigation
Ernesto RA
Currently Being Moderated

What is the scope of the queries cached with cachedwithin on CF10? Server or application?

Oct 15, 2012 6:01 AM

Tags: #cache #cfquery #cf10 #cachedwithin

Hello,

 

We have recently migrated from CF8 to CF10 and noticed an unexpected behavior on our cached queries.

 

We are a news site and have two applications on our server (CF 10, Centos 5.8 64 bits), one for the front-end to readers, and another one for administrators of the site. We made extensive use of cached queries, always with cachedwithin, and always on CFCs. When a user read an article, the query that retrieve that article is cached for 15 minutes, and if an administrator makes a change on that article, after the update we call exactly the same read query with a cachedwithin(0,0,0,0) in order to clear the cached data.

 

That worked fine until the upgrade to CF 10, when we realized that the calls for cleaning the cached queries were not working. After a lot of testing we noticed that if we call the cleaning cache query withing the readers application scope, then it is correctly erased from the cache for the readers. The exact same query called from administrators scope only clears the cache for the administrators, not the readers.

 

Reading the cache documentation I have only found references to the different scopes of ehcache, but I don't know if those scopes also applies to the cachedwithin cached queries. Also, supposedly the cache scope by default is server, not application....

 

So, are the queries cached with cachedwithin cached on an application scope, as it seems? Is there a way to change this in order to make them cached on a server scope? Would be better to migrate to cache functions like cachePut() and cacheRemove()?

 

Thanks in advance,

 

(please forgive my poor english, need some more practice at writing...)

 
Replies
  • Currently Being Moderated
    Oct 15, 2012 6:33 AM   in reply to Ernesto RA

    This appears to be a bug in CF10.

     

    I'm just getting a portable repro case sorted out, and will report back.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2012 7:25 AM   in reply to Adam Cameron.

    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?

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2012 9:43 AM   in reply to Ernesto RA

    Cool, yeah Rob Brooks-Bilson added a comment to my blog article, pointing to the appropriate page in the docs.

     

    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.

     

    --

    Adam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points