[xwiki-users] problem with the cache macro
May be a basic problem but when I use the {{cache}} macro, the content is never refreshed (not after the default 5 minutes, nor the specified time by the timeToLive). I'm using XWiki 4.2. -- View this message in context: http://xwiki.475771.n2.nabble.com/problem-with-the-cache-macro-tp7582215.htm... Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi, On Nov 7, 2012, at 9:39 AM, aflament <[email protected]> wrote:
May be a basic problem but when I use the {{cache}} macro, the content is never refreshed (not after the default 5 minutes, nor the specified time by the timeToLive).
I'm using XWiki 4.2.
Could you show us exactly a snipper of how you use the cache macro? Thanks -Vincent
{{cache timeToLive="14400"}} {{groovy}} import groovy.sql.Sql request = '...' sql = Sql.newInstance( '...', '...', '...', '...' ) sql.eachRow( request ) { println "* $it.qui" } {{/groovy}} {{/cache}} -- View this message in context: http://xwiki.475771.n2.nabble.com/problem-with-the-cache-macro-tp7582215p758... Sent from the XWiki- Users mailing list archive at Nabble.com.
The cache macro refresh its content when the macro has not been used during 5 minutes actually not when it's 5 minutes old AFAIK. On Wed, Nov 7, 2012 at 11:00 AM, aflament <[email protected]> wrote:
{{cache timeToLive="14400"}}
{{groovy}} import groovy.sql.Sql
request = '...'
sql = Sql.newInstance( '...', '...', '...', '...' ) sql.eachRow( request ) { println "* $it.qui" } {{/groovy}}
{{/cache}}
-- View this message in context: http://xwiki.475771.n2.nabble.com/problem-with-the-cache-macro-tp7582215p758... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Since in your installation, the page is accessed every 5 minutes by a cron script, the cache never expires. The cron script is a simple call to curl that copy the content of the wiki page to a static html page. The aim is to make a home page that is very fast to render. Disabling the pooling during the night will solve the problem. Thank you for yours answers. -- View this message in context: http://xwiki.475771.n2.nabble.com/problem-with-the-cache-macro-tp7582215p758... Sent from the XWiki- Users mailing list archive at Nabble.com.
On Nov 7, 2012, at 11:30 AM, Thomas Mortagne <[email protected]> wrote:
The cache macro refresh its content when the macro has not been used during 5 minutes actually not when it's 5 minutes old AFAIK.
hmm I've never fully realized this actually… :) So I guess we need to work on also having another parameter for doing it the other way around, i.e. updating the content every N minutes since I believe this is a more common need. It means that with the current situation you can't control how frequently you get fresh content… Is that possible with our Cache implementation? Note that we also need to make this work in a thread so that content is fetched time-based and asynchronously without needing a hit since that slows the unfortunate user who's calling the page when the timeout expires. Thanks -Vincent
On Wed, Nov 7, 2012 at 11:00 AM, aflament <[email protected]> wrote:
{{cache timeToLive="14400"}}
{{groovy}} import groovy.sql.Sql
request = '...'
sql = Sql.newInstance( '...', '...', '...', '...' ) sql.eachRow( request ) { println "* $it.qui" } {{/groovy}}
{{/cache}}
On Wed, Nov 7, 2012 at 7:28 PM, Vincent Massol <[email protected]> wrote:
On Nov 7, 2012, at 11:30 AM, Thomas Mortagne <[email protected]> wrote:
The cache macro refresh its content when the macro has not been used during 5 minutes actually not when it's 5 minutes old AFAIK.
hmm I've never fully realized this actually… :)
So I guess we need to work on also having another parameter for doing it the other way around, i.e. updating the content every N minutes since I believe this is a more common need. It means that with the current situation you can't control how frequently you get fresh content… Is that possible with our Cache implementation?
Infinispan support it yes but we will need to add a new Algorithm in https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik...
Note that we also need to make this work in a thread so that content is fetched time-based and asynchronously without needing a hit since that slows the unfortunate user who's calling the page when the timeout expires.
Thanks -Vincent
On Wed, Nov 7, 2012 at 11:00 AM, aflament <[email protected]> wrote:
{{cache timeToLive="14400"}}
{{groovy}} import groovy.sql.Sql
request = '...'
sql = Sql.newInstance( '...', '...', '...', '...' ) sql.eachRow( request ) { println "* $it.qui" } {{/groovy}}
{{/cache}}
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
participants (3)
-
aflament -
Thomas Mortagne -
Vincent Massol