OK.
 
Can I create my own HtmlCacheEntry and replace the default one at run time (like in Zope with dynamic instropection) or do I need to modify the Jahia core ?
 
Ghislain


 

Ghislain,

 

In Jahia 4.1 you can access the cache with:

CacheFactory.getHtmlCache()

and in Jahia 5.0 with:

ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance()

But as I noted before, the cache doesn’t support timestamps (or even a Boolean value to say it has changed since last checked). You would need to implement this feature for this to work. Simply modify the org.jahia.services.cache.HtmlCacheEntry constructor to initialize a Date object which would be your timestamp. Then add an accessor method for this Date timestamp to HtmlCacheEntry in order to retrieve the Last-Modified date.

 

Regards,

 

Marc

 

 

 

>

From: ghislain.cussonneau [mailto:[EMAIL PROTECTED]
Sent: 30 November 2005 15:13
To: template_list
Subject: RE: Publication date

 

>
>

Marc,

>

 

>

Ok, It's a very good idea.

>

Now, how can I request the HTMLCache to see if the page has been update ?

>

 

>

Ghislain

>
>

>

 

 

Ghislain,

 

Another option would be to check in Jahia’s HtmlCache to see if the cache entry for the requested page has been updated –and if so, at which point in time. You could then return the correct HTTP Last-Modified header. Currently however, the org.jahia.services.cache.HtmlCache and HtmlCacheEntry classes don’t support timestamps. You would need to implement this feature for this to work.

 

Hope this helps,

 

Regards

 

Marc

 

 

 

>

>


From: ghislain.cussonneau [mailto:[EMAIL PROTECTED]
Sent: 28 November 2005 09:27
To: template_list
Subject: Re: Publication date

 

>

>

>

>

Ok

>

>

 

>

>

I don't think about this problems of "content being reused". So I just still use cache for pictures and other graphics resources.

>

>

 

>

>

Thanks for your answers

>

>

Ghislain

>

>

 

>

>

>

>


>

>

 

 


Ok but how do you know then the inter-relationships between your pages. For example you create a new page on the top vertical menu. Even if you validate and then flush this new page, how do you know that you will also need to flush ALL the pages of your site, as this new top menu will also appear on all the pages of your site!!! The same is true with all content being reused from an absolute manner on your site (ex: you validate a news somewhere on pid234 but that news also appear then on the home page and in 4 others sections in your site...). So you need either to flush all your cache each time there is a modification (just to be sure they are consistent) or to know all the relationships for each object of content being validated (= on which other pages such and such content is reused...)... And for that we use AOP in Jahia 5.0 in order to automatically detect such relationships which are most of the time hardcoded into your templates JSP scriptlets and that Jahia ignores....

Stéphane

At 14:32 25.11.2005, you wrote:

The external proxy cache will be used only in anonymous access because of the problem inconstent cache. Most off the sites are anonymous access. So in the file "declarations.inc", I've had this. But I don't know how-to calculate the dLastPublicationTime date.

//
Definition des headers en fonction des droits des utilisateurs

// Si on est en anonyme --> utilisation du cache Apache

logger. debug(
"Page " + jData.page ().getID () + " (" + jData.page ().getTitle () + ")" );

if (!jData
.gui ().isLogged ())

{

int iCacheMaxExpire = 24 *3600;

Date dExpires = new Date
();

dExpires. setTime( dExpires. getTime() + iCacheMaxExpire) ;

Date dLastPublicationTime = new Date
();    // <--- How to calculate this date ?

logger. debug(
"Header Expires = " + getDateAsRFC822String( dExpires)) ;

logger. debug(
"Header Last-Modified = " + getDateAsRFC822String( dLastPublicationTime ));

logger. debug(
"Header Cache-Control = " + "max-age=" + iCacheMaxExpire + ", must-revalidate") ;

response. addHeader(
"Expires", getDateAsRFC822String( dExpires)) ;

response. addHeader(
"Last-Modified" , getDateAsRFC822String( dLastPublicationTime ));

response. addHeader(
"Cache-Control" , "max-age=" + iCacheMaxExpire + ", must-revalidate") ;

}

// Autrement --> pas de cache Apache

else

{

Date dExpiresAbsolute = new Date
();

dExpiresAbsolute. setTime( dExpiresAbsolute. getTime() + 86400
);

logger. debug(
"Header Cache-Control = no-cache") ;

logger. debug(
"Header Pragma = No-Cache") ;

logger. debug(
"Header ExpiresAbsolute = " + getDateAsRFC822String( dExpiresAbsolute)) ;

logger. debug(
"Header Expires = -1");

response. addHeader(
"Cache-Control" , "no-cache" );

response. addHeader(
"Pragma", "No-Cache" );

response. addHeader(
"ExpiresAbsolute" , getDateAsRFC822String( dExpiresAbsolute)) ;

response. addHeader(
"Expires", "-1" );

}



Mmmh it risks to be a bit less trivial than that.... Content may be reused on several pages (so you can't simply flush the current page). Moreover, on the same page, you can have various different permissions. etc, etc... So replacing the current jahia HTML cache by an external cache proxy is not so simple and rapidly your cache proxxy will become inconsistent. We are now working for Jahia 5.0 on a new full cache server which will be compliant with the ESI standard (= you can manage HTML fragments on a page and not only full pages). Meanwhile it seems to me more easy to just embed some JSP cache taglibs (cf OSCache HTML tags for instance) in your set of templates rather than trying to configure an external cache proxy.

Cheers,
Stéphane

At 11:22 25.11.2005, ghislain\.cussonneau wrote:

Hi !
 
I use Jahia 4.0.6 and I want to use the apache cache server in front-off Jahia for the HTML content. To do that, Jahia need to send some Http Headers to Apache :
- Expires : (now + cache_max_expire_constant) date in rfc822 format
- Last-Modified : last publication date in rfc822 format
- Cache-Control : max-age=cache_max_expire_constant, must-revalidate
- ExpiresAbsolute : (nom + 24 hours) in rfc822 format
 
My problem is about calculate the "Last-Modified" date : I want to use the date of the publication of the page in the workflow.
 
Is it possible with Jahia 4.0.6, because I can't find in Jahia API how to get it ?
Which version of Jahia do I need to use ?
 
Thanks in advance
 
Ghislain CUSSONNEAU
DIRR/DPIL/CIS
CAP 44, Rue Marcel Sembat
44000 Nantes

02 51 84 48 80


Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)


- -- --- -----=[ scroisier at jahia dot com ]=---- --- -- -
CEO - Jahia Ltd, 45 rue de la gare, 1260 Nyon (Switzerland)
Jahia : The Java Unified Web Platform
www.jahia.org
- The community and product web site
www.jahia.com
- Our commercial services company
www.collaborativesource.org
- The Collaborative Source Initiative
 
 
Ghislain CUSSONNEAU
DIRR/DPIL/CIS
CAP 44, Rue Marcel Sembat
44000 Nantes

02 51 84 48 80
CRIL Technology
Technoparc de l'Aubinière
44000 Nantes

02 51 89 64 50


Accédez au courrier électronique de La Poste :
www.laposte.net ;
3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

- -- --- -----=[ scroisier at jahia dot com ]=---- --- -- -
CEO - Jahia Ltd, 45 rue de la gare, 1260 Nyon (Switzerland)
Jahia : The Java Unified Web Platform
www.jahia.org - The community and product web site
www.jahia.com - Our commercial services company
www.collaborativesource.org - The Collaborative Source Initiative

>

>

 

>

>

 

>

>

Ghislain CUSSONNEAU

>

>

DIRR/DPIL/CIS

>

>

CAP 44, Rue Marcel Sembat

>

>

44000 Nantes

>

>

02 51 84 48 80

>

>

CRIL Technology

>

>

Technoparc de l'Aubinière

>

>

44000 Nantes

>

>

02 51 89 64 50

>

>

>

>

 

>

>

 

>

>

Accédez au courrier électronique de La Poste : www.laposte.net ;

>

>

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

>

 

>

 

>

Ghislain CUSSONNEAU

>

DIRR/DPIL/CIS

>

CAP 44, Rue Marcel Sembat

>

44000 Nantes

>

02 51 84 48 80

>
>

 

>

 

>

Accédez au courrier électronique de La Poste : www.laposte.net ;

>

3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)

 
 
Ghislain CUSSONNEAU
DIRR/DPIL/CIS
CAP 44, Rue Marcel Sembat
44000 Nantes
02 51 84 48 80
CRIL Technology
Technoparc de l'Aubinière
44000 Nantes
02 51 89 64 50


Accédez au courrier électronique de La Poste : www.laposte.net ;
Jusqu'au 25 décembre, participez au grand jeu du Calendrier de l'Avent et
 gagnez tous les jours de nombreux lots, + de 300 cadeaux en jeu !

Reply via email to