[PHP] Re: PHP XSLT caching

2008-10-27 Thread Colin Guthrie

vladimirn wrote:

I have one simple question, actually i am interested in your point of view.
Is there any sense in caching xslt itself? If so, then why? If not, then
again why? :)
I think that there is no sense, and that xslt output should be cached.
What do you think?


From your original context it wasn't clear whether you wanted to cache 
the dom document *object* that represents the xslt or the output of the 
transfer after it is applied.


As I explained, (and I think I'm still correct in this), storing the 
object would be kinda pointless as it would have to be serialized to 
string form and then re-parsed on wakeup. Doing this rather than 
reloading from disk again, will save a minor amount of IO and thus time, 
but the saving will be minimal.


So IMO caching the xslt is not worth the effort. Cache the output of the 
transform and load the xslt only when needed.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP XSLT caching

2008-10-26 Thread Colin Guthrie

vladimirn wrote:

Hi all,
i was wondering whats the best approach to do next.
I have an xml file delivered from service of my partner. On my web server 
(windows) i have xslt files used for xml transformation. 
Those files are getting bigger, so i have request to cash them and use

cashed. I was thinkging about memcahce php(dunno if it will work on windows
server and tbh never used it before).
So i am sure that there must be several ways to cash xslt files. I google
for this, but i am not sure that i found any solution i can use.
What would be the best approach to solve this? I just would like to see more
ideas :)
LOL sure, if someone already have a good working solution i would appreciate
any link or code :0)


Well you have to define what you actually want to do do here as it's a 
little unclear from your description.


Do you want to cache the XSLT files themselves or do you want to cache 
the result of *applying* the XSLT files to the input XML?


If you just want to cache the XSLT itself (e.g. loaded into a DOM 
document object) then there is little point as you would have to 
serialize and deserialize the dom document objects before storing them 
(via extending the class and adding __sleep() and __wakeup() methods) as 
I am pretty sure Dom Document doesn't do this automatically (last I 
checked which was admittedly a while ago!).


This only saves a small amount of overhead.

If you are looking for a good set of classes that can handle generic 
caching, I'd strongly recommend using the Zend_Cache system.

http://www.framework.zend.com/manual/en/zend.cache.html

Zend cache will support disk-based caching and memcache or APC too all 
via the same API.


Col





--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP XSLT caching

2008-10-26 Thread Colin Guthrie

vladimirn wrote:

Thank you Col
I will go into Zend_Cache as you suggested.
One more thing- does Zend_Cache saces data into file or use a server memory?


As I said in my original mail, but perhaps wasn't clear, Zend_Cache can 
support file, memcache, APC and other backends.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php and caching

2002-11-24 Thread Stephan Seidt
Maybe Pear's Cache class could help you..
But I'm not sure, never played around with it in detail.

On Sun, 24 Nov 2002 12:47:08 -0500
[EMAIL PROTECTED] (Alex) wrote:

 Hi,
 
 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to forms
 and that these forms still contain the information they entered (instead of
 being cleared).
 
 Can someone give me a hint on how to accomplish this if there's a way to do
 it?
 
 Thanks,
 
 Alexandre Soares
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: php and caching

2002-11-24 Thread Alex
But my  main page, for instance mail.php, includes top.php and bottom.php.
But top.php must be processed each time because it prints on every page on
my site if the user has new messages. But if all pages are cached, then it's
always the cached version that's printed to the user, so even if he has new
mail, it doesn't show (because the page is directly taken from the cache
instead of being re-requested).
So I don't want this situation to happen, but i'd want users to be able to
make use of their back button without clearing the forms. Is there a
solution around this problem?

Thanks alot!


Alex [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to
forms
 and that these forms still contain the information they entered (instead
of
 being cleared).

 Can someone give me a hint on how to accomplish this if there's a way to
do
 it?

 Thanks,

 Alexandre Soares





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 22:38 24.11.2002, Alex said:
[snip]
But my  main page, for instance mail.php, includes top.php and bottom.php.
But top.php must be processed each time because it prints on every page on
my site if the user has new messages. But if all pages are cached, then it's
always the cached version that's printed to the user, so even if he has new
mail, it doesn't show (because the page is directly taken from the cache
instead of being re-requested).
So I don't want this situation to happen, but i'd want users to be able to
make use of their back button without clearing the forms. Is there a
solution around this problem?
[snip] 

You can't have all of both worlds - either allow the browser to cache, then
the form content will be still available from the back button. Or you
disallow caching, then it won't.

Of course you can always control what is allowed to cache - e.g. you might
allow the page containing the form to be cached, but not the results page.

However if you're using sessions, and your form is already session based,
even an uncached form could still be populated by your script when using
session variables.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and caching

2002-11-24 Thread Robert Cummings
Ernest E Vogelsinger wrote:
 
 At 22:38 24.11.2002, Alex said:
 [snip]
 But my  main page, for instance mail.php, includes top.php and bottom.php.
 But top.php must be processed each time because it prints on every page on
 my site if the user has new messages. But if all pages are cached, then it's
 always the cached version that's printed to the user, so even if he has new
 mail, it doesn't show (because the page is directly taken from the cache
 instead of being re-requested).
 So I don't want this situation to happen, but i'd want users to be able to
 make use of their back button without clearing the forms. Is there a
 solution around this problem?
 [snip]
 
 You can't have all of both worlds - either allow the browser to cache, then
 the form content will be still available from the back button. Or you
 disallow caching, then it won't.

Actually you can. Try using session variables.

Cheers,
Rob.
-- 
.-.
| Worlds of Carnage - telnet wocmud.org 4000  |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 00:27 25.11.2002, Robert Cummings said:
[snip]
 You can't have all of both worlds - either allow the browser to cache, then
 the form content will be still available from the back button. Or you
 disallow caching, then it won't.

Actually you can. Try using session variables.
[snip] 

If you read my complete post you'll notice that I suggested using session
variables. The issue why I first answered the question _without_ talking
about session variables is the fact that Alex was talking about a search
form. Search forms are often used on normal static web pages _without_
the help of sessions... that's the reason.

Rest assured I know about sessions in PHP :)


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and caching

2002-11-24 Thread Robert Cummings
Ernest E Vogelsinger wrote:
 
 If you read my complete post you'll notice that I suggested using session
 variables. The issue why I first answered the question _without_ talking
 about session variables is the fact that Alex was talking about a search
 form. Search forms are often used on normal static web pages _without_
 the help of sessions... that's the reason.
 
 Rest assured I know about sessions in PHP :)

That'll teach me to form an opinion and skim :) My apologies.

Cheers,
Rob.
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: php and caching

2002-11-24 Thread Alex
If the page itself is never cached to force dynamic php pages to always be
fresh, is there a way to cache only images to reduce bandwidth usage?

Thanks, (and thanks for all your good advices!)

Alex [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to
forms
 and that these forms still contain the information they entered (instead
of
 being cleared).

 Can someone give me a hint on how to accomplish this if there's a way to
do
 it?

 Thanks,

 Alexandre Soares





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 01:04 25.11.2002, Alex said:
[snip]
If the page itself is never cached to force dynamic php pages to always be
fresh, is there a way to cache only images to reduce bandwidth usage?
[snip] 

Alex,

images are a separate page if you want; the browser issues a separate
request for the image which is only _referenced_ by the page, not
_contained_ within. As such the caching requirements for an image are
unique and absolutely not connected to the caching restrictions of the page
it is referenced from.

That said: if your page is non-cacheable, images it contains will still be
cached if the server allows this. 

If you're image tags look like this:
img src=../images/somepic.gif
it's most likely the image will be cached (like any other static file).

For a tag like
img src=../imgdb/getimg.php?id=4711
the script getimg.php would need to issue the appropriate cache
directives to allow caching.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php