Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread Vincent Massol
Hi,

On Nov 7, 2012, at 9:39 AM, aflament aflam...@geodisbm.com 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

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread aflament
{{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-tp7582215p7582228.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread Thomas Mortagne
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 aflam...@geodisbm.com 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-tp7582215p7582228.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Thomas Mortagne
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread aflament
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-tp7582215p7582230.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread Vincent Massol

On Nov 7, 2012, at 11:30 AM, Thomas Mortagne thomas.morta...@xwiki.com 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 aflam...@geodisbm.com wrote:
 
 {{cache timeToLive=14400}}
 
 {{groovy}}
 import groovy.sql.Sql
 
 request = '...'
 
 sql = Sql.newInstance( '...', '...', '...', '...' )
 sql.eachRow( request ) {
 println * $it.qui
 }
 {{/groovy}}
 
 {{/cache}}

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] problem with the cache macro

2012-11-07 Thread Thomas Mortagne
On Wed, Nov 7, 2012 at 7:28 PM, Vincent Massol vinc...@massol.net wrote:


 On Nov 7, 2012, at 11:30 AM, Thomas Mortagne thomas.morta...@xwiki.com
 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/xwiki-platform-cache/xwiki-platform-cache-api/src/main/java/org/xwiki/cache/eviction/EntryEvictionConfiguration.java



 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 aflam...@geodisbm.com wrote:
 
  {{cache timeToLive=14400}}
 
  {{groovy}}
  import groovy.sql.Sql
 
  request = '...'
 
  sql = Sql.newInstance( '...', '...', '...', '...' )
  sql.eachRow( request ) {
  println * $it.qui
  }
  {{/groovy}}
 
  {{/cache}}

 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Thomas Mortagne
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users