473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to Clear Cache

Hello Group,

I have a php file which will list the pending
task for each developer. If the developer
changes some thing it will update to database.
Once the user clicks the update button it shows
the another page and there will be button back to
list of pending task. It will again fetch from database.

At the second time if user update some other data. It giving
me the old data list also.

Anyone Pls suggest me how to clear the cache in PHP.

I used ClearStatCache() this is not working. And also I added

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0"> in my php file.
Jul 17 '05 #1
2 38155
Sure <cs*******@yahoo.com> wrote:
At the second time if user update some other data. It giving
me the old data list also.

Anyone Pls suggest me how to clear the cache in PHP.
Don't try to fix the symptoms, fix the real problem. You simply can't
clear a cache in a browser.
I used ClearStatCache() this is not working. And also I added

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0"> in my php file.


Don't use those silly equivs if you can use the real http headers.
Setting the expires header in the past should normally be enough.

You could send a correct last-modified header (which you have to store
somewhere (might already be in the database)) and check if a client
does a conditional request (if-not-modified-since IIRC).

You should take a look at chapter 13 and 14.9 of the HTTP 1.1 protocol
(rfc 2616) to find out how to control/prevent/hint caching.
Jul 17 '05 #2
Sure wrote:
Hello Group,

I have a php file which will list the pending
task for each developer. If the developer
changes some thing it will update to database.
Once the user clicks the update button it shows
the another page and there will be button back to
list of pending task. It will again fetch from database.

At the second time if user update some other data. It giving
me the old data list also.

Anyone Pls suggest me how to clear the cache in PHP.

I used ClearStatCache() this is not working. And also I added

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0"> in my php file.


Hi,

Caching can be a pain in the ... side?
:-)

You use:
<META HTTP-EQUIV="expires" CONTENT="0">
Why did you put 0 there?

Are you aware that "0" is an illegal value?

(Illegal values should mean: expire immediately)

Read this:
http://vancouver-webpages.com/META/metatags.detail.html

But that doesn't solve your problem, does it?

I can think of two solutions:

1) GOOD SOLUTION: Start reading a lot about caching and try to solve it by
sending a right set of header. You could start here:
http://vancouver-webpages.com/CacheNow/

2) Poor men solution (the one I use. :P)
Trick possible cachingmechanisms (in the browser or a proxyserver) by asking
for 'another' page by adding a little extra to the script.

Like this:

<form action="yourpage.php?dontcacheme=<?= time() ?>" >
By the way: I never experienced the problem you describe with forms, only
with hyperlinks. Not sure if that means anything...

Good luck!

Regards,
Erwin Moller
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB...
3
by: DC Gringo | last post by:
I have an app that I can't seem to clear out server resources with a button onclick event: The session variables seem to be disappearing properly, but the aspnet_wp.exe process stays where it...
3
by: Fabio R. | last post by:
I'm developing a web application that needs to support a webfarm scenario so I've used a filecachedependency on a shared folder (for now, always in my local machine) to clear cache on all...
1
by: Tanmaya Kulkarni | last post by:
Hi, Am developing an ASP.Net web app where am caching many pages (say abc.aspx, def.aspx) as they are access by Response.Cache.SetExpires(DateTime.Now.AddSeconds(3600)) Now there is another...
2
by: raji20 | last post by:
I'm frequently updating images on my site when the users clicks on the submit button, and some users have reported they are seeing old images where new ones should be... The image that is getting...
5
by: Harry Keck | last post by:
I have an application that I recently converted to 2.0 from 1.1. This application is relying on data stored at HttpContext.Current.Cache. When I run in 1.1 the data stays available in the cache,...
1
by: santhoskumara | last post by:
I am using Internet Explorer browser, I want to know how to clear cache and cookies using javascript function or java, when each time the page is loaded. i know to do manually in IE using TOOLS...
1
by: Ravenshield | last post by:
Hi there all. (first of all, sorry about my bad english) I need some help over here. I'm developing an asp.net application that works as an administrator site for other application built in flash....
0
by: sankarsatvik | last post by:
I am using open flash chart to create charts. Chart is displaying button onclick. Flash chart is displaying iframe.it is working fine except IE. But In IE, it displaying old one. If we clear cache...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.