Ask a Question related to PHP Development, Design and Development.
-
Mike P #1
cache question
I've read a couple of articles on cache and setting expiration etc.
What I can't find the answer to is - if you don't set an expiration for
your cache, what is the default? And when your cache does expire, how
do you catch this event? For example, if I have a datagrid which is
populated by cached data and the cached data expires, what happens when
I try to access that datagrid?
Any help would be much appreciated.
Cheers,
Mike
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Mike P Guest
-
Client-Side Cache Question
Let's say I have a FLV that "lives" on a server, and I serve it up through, say, Ruby. The Ruby script takes care of obtaining the FLV from the... -
Cache?
Hi I'm new to web services but have done a bit with web applications Is there a cache in web services as in web applications I want to read in... -
mm cache
http://www.turcksoft.com/en/e_mmc.htm -
Cache object question
Use HttpContext.Current.Cache. -- James J. Foster, DotNetCoders http://www.dotnetcoders.com "STom" <stombiztalker@hotmail.com> wrote in... -
lwp and dns cache
I was wondering if there is anyway of having lwp cache its dns queries. What I am doing is getting dynamic data from various sites every five... -
PJ #2
Re: cache question
the cache will expire when the aspnet_wp is forced to recycle
when accessing cache data do something like this in a static method to
retrieve the data
string myCachedData = HttpContext.Current.WebCache("myCachedData");
if ( myCachedData == null )
{
// code to put the data in the cache
}
return myCachedData;
"Mike P" <mrp@telcoelectronics.co.uk> wrote in message
news:uewfqPnVDHA.2352@TK2MSFTNGP12.phx.gbl...> I've read a couple of articles on cache and setting expiration etc.
> What I can't find the answer to is - if you don't set an expiration for
> your cache, what is the default? And when your cache does expire, how
> do you catch this event? For example, if I have a datagrid which is
> populated by cached data and the cached data expires, what happens when
> I try to access that datagrid?
>
>
> Any help would be much appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
PJ Guest
-
Mike P #3
Re: cache question
What will cause aspnet_wp to recycle? Is it recycled when a session
times out?
Mike
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Mike P Guest
-
Ryan Gregg #4
Re: cache question
It is recycled when
a) an application level error occurs
b) the server is restarted (or IIS is restarted)
c) an application times out, meaning it hasn't been accessed in the time
out period
d) in IIS 6.0 all applications are recycled on a set time period (set in
the IIS manager). I beleive the default is 29 hours.
e) If you recompile the application, when ASP.NET notices the change, it
recycles the application
Ryan Gregg
"Mike P" <mrp@telcoelectronics.co.uk> wrote in message
news:uOB52BoVDHA.652@tk2msftngp13.phx.gbl...> What will cause aspnet_wp to recycle? Is it recycled when a session
> times out?
>
> Mike
>
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Ryan Gregg Guest
-
PJ #5
Re: cache question
And I believe it happens when you modify the machine.config or web.config as
well...
"Ryan Gregg" <rgregg@wheatlandsystems.com> wrote in message
news:ehXrBHrVDHA.1748@TK2MSFTNGP12.phx.gbl...time> It is recycled when
> a) an application level error occurs
> b) the server is restarted (or IIS is restarted)
> c) an application times out, meaning it hasn't been accessed in thein> out period
> d) in IIS 6.0 all applications are recycled on a set time period (setit> the IIS manager). I beleive the default is 29 hours.
> e) If you recompile the application, when ASP.NET notices the change,> recycles the application
>
>
> Ryan Gregg
>
> "Mike P" <mrp@telcoelectronics.co.uk> wrote in message
> news:uOB52BoVDHA.652@tk2msftngp13.phx.gbl...>> > What will cause aspnet_wp to recycle? Is it recycled when a session
> > times out?
> >
> > Mike
> >
> >
> >
> > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> > Don't just participate in USENET...get rewarded for it!
>
PJ Guest
-
Alvin K #6
Cache question
Via the -global.asax- file, on application startup,
the following code does not work:
System.Web.Caching.Cache.Insert (works on all other pages ...)
whereas this works fine:
HttpContext.Current.Cache.Insert
Can anyone explain why this is so?
Alvin K Guest
-
William F. Robertson, Jr. #7
Re: Cache question
On application start there is no automatically mapped reference to the
current Cache object.
The object is handled through the HttpContext.Current.
When you reference the Cache object (or session or application) on a page,
you are in the HttpContext.Current by default.
You will have to reference the Cache object through the HttpContext.Current
outside of a direct request for a page. That goes for a web control library
or anything else outside a page request.
I have even had trouble with it when I created two threads in the same web
request.
bill
"Alvin K" <asianx74@yahoo.com> wrote in message
news:cd0e8b44.0307301239.3443d399@posting.google.c om...> Via the -global.asax- file, on application startup,
>
> the following code does not work:
>
> System.Web.Caching.Cache.Insert (works on all other pages ...)
>
> whereas this works fine:
>
> HttpContext.Current.Cache.Insert
>
> Can anyone explain why this is so?
William F. Robertson, Jr. Guest
-
Mike P #8
Re: cache question
So assigning something to the Cache is essentially the same as assigning
it to a Session variable (i.e. it expires on timeout and is particular
to the specific user and not the application)?
Mike
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Mike P Guest
-
Mike P #9
Re: cache question
I've done a few tests and found that Cache is Application level and not
Session level, which I would think means that it can only be used for
storing global variables.
Mike
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Mike P Guest
-
Tony Tzankoff #10
Cache Question
I have a webpage written in the latest version of PHP and need a little bit
of help with a rather pesky cache issue. Part of the source code is as
follows:
page.php
<?
echo "<meta http-equiv=pragma content=no-cache>";
echo "<meta http-equiv=expires content='-1'>";
Tony Tzankoff Guest
-
Chris Shiflett #11
Re: [PHP] Cache Question
--- Tony Tzankoff <ttzankoff@medscripts.com> wrote:
In order to understand this behavior, you need to understand how the Web works,> I have a webpage written in the latest version of PHP and need
> a little bit of help with a rather pesky cache issue. Part of
> the source code is as follows:
>
> page.php
> <?
> echo "<meta http-equiv=pragma content=no-cache>";
> echo "<meta http-equiv=expires content='-1'>";
> echo "<embed src=filename.mp3 autostart=true>";
> ?>
>
> The page does not cache (which is good), but the MP3 file does
> (which is bad). Is there a way to NOT cache the MP3 file? I
> would like to keep the file embedded within the page, if
> possible. Thanks!
including a little bit about HTTP.
First, as an aside note, if you are using PHP, there is absolutely no reason to
set HTTP headers using the HTML meta tag. This is equivalent to the HTML in
your example code:
header('Pragma: no-cache');
header('Expires: -1');
Since Pragma is an HTTP/1.0 header, might I also suggest:
header('Cache-Control: no-cache');
Now, you are wondering how you can have all of these headers, yet the MP3 is
still cached. That's because these headers are not sent when the MP3 is
requested. The filename ends in .mp3, so PHP plays no role whatsoever (unless
you have done something weird to force PHP to parse files ending in .mp3).
When a Web clients sends the HTTP request for your page, it will receive
something like this in the content of the response:
<meta http-equiv=pragma content=no-cache>
<meta http-equiv=expires content='-1'>
<embed src=filename.mp3 autostart=true>
Basically, the content is the output of your script, right? *This* is the stuff
that won't get cached.
Now, "filename.mp3" is just some text in the response at this point. There is
no MP3 actually embedded into the HTML somehow. The browser parses the HTML and
notices that it needs another resource, filename.mp3. Because there is no path
specified, the browser will send a request for this resource using the same
path as its parent (the page that is not going to be cached). The server will
return this file in an HTTP response, and the headers in this response have
nothing to do with your PHP script that was requested a few seconds ago. That
is history.
So, this is why the MP3 is cached while your HTML is not.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
[url]http://httphandbook.org/[/url]
Chris Shiflett Guest
-
Ivo Fokkema #12
Re: Cache Question
Hi Tony,
Chris explained a lot about this... I'm not an expert on this, but you might
want to give a try to embed something like :
"<embed src='mp3.php?mp3=filename' autostart=true>";
And then let mp3.php send all of the no-cache headers together with the
contents of the filename.mp3.
It might work, I would give it a try...
HTH,
--
Ivo
"Tony Tzankoff" <ttzankoff@medscripts.com> wrote in message
news:20030812152237.78650.qmail@pb1.pair.com...bit> I have a webpage written in the latest version of PHP and need a little> of help with a rather pesky cache issue. Part of the source code is as
> follows:
>
> page.php
> <?
> echo "<meta http-equiv=pragma content=no-cache>";
> echo "<meta http-equiv=expires content='-1'>";
> .
> .
> .
> echo "<embed src=filename.mp3 autostart=true>";
> ?>
>
> The page does not cache (which is good), but the MP3 file does (which is
> bad). Is there a way to NOT cache the MP3 file? I would like to keep the
> file embedded within the page, if possible. Thanks!
>
>
Ivo Fokkema Guest



Reply With Quote

