Hey guys,
I've seem to forgotten how to cache a php page so that when the a link is clicked the dynamic content is only grabbed from the DB only once a day.
every Google results point to /not/ caching.
I've got caching enabled so that now my back/forward browser button do not regenerate the page.
FYI: It's a report that takes a long time to regenerate.
Other pages on my site, the search and filter pages, those should not cache anything, so whatever solution, it must apply to specific pages.
Code: -
-
$secondsToMidnight = (strtotime('midnight')+86400)-time();
-
header("Pragma: public");
-
header("Cache-Control: maxage=$secondsToMidnight"); // HTTP/1.1
-
header("Expires: " . date('r',time()+$secondsToMidnight)); // Date in the past
-
-
Besides saving the output buffer to a file, is there any other way to force PHP/FF Browser to keep the same output.
Thanks,
Dan
10 2065
Yes, from the description of it, it looks like that's along the lines of what i'm looking for, but not a PECL installation. I'm working with php 5.1.6 core only.
Thanks,
Dan
Search engines perform particular searches once every so often, and then save the results into another database table for easy access. Maybe you'd be interested in that technique?
that’s like session storage in a DB …
You could just perform the cache yourself? Saving the content to a static .html file , checking on page load whether it needs to be updated.
@Markus: I thought that's what the PHP cache apps did. I've never tried any, though.
Ya Markus, that's one route I was considering too since I can't get MySQL cache to work on this server.
The Database schema is not mine (it's another systems) so adding tables is not an option unless I create a separate database. I don't want to get into double database situation just for caching.
@Kovik, what do you mean by PHP cache apps? like Smarty? Ya, that would work, but it will require change to my framework. It's not an "insert header/footer" method but a "insert dynamic content" one.
Conclusion: Save static.html file in a /tmp folder for now.
Thanks guys,
Dan
@kovik
I have no idea about Memcache, but APC caches PHP's opcodes.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nadav |
last post by:
Hi,
I am new to WebControls, I have created a WebControl that is used to present
an image, the image bing presented is created on runtime, each client side
button click causes the image to...
|
by: moondaddy |
last post by:
I have a products catalogue that I'm putting online and there will be
between 20 to 50 different pages of products. Each page contains a datagrid
of products for a given category. However, the...
|
by: sviau |
last post by:
should cache-control be set to public or private on dynamic site. our
content doesnt change for 24hrs, but because results from search pages vary
so much, we cant cache the pages themselves.
...
|
by: Just D. |
last post by:
All,
Can we enable/disable the cache for each control separately or it's a global
feature for the whole page? I'm aware of many settings and some bugs
regarding cache but I've never seen...
|
by: Stephane |
last post by:
Hi,
All images on my ASP.Net web site are reloaded almost each time I visit a
page. My chache setting on IE is set to Automatically. When I visit another
web site, images are rarely reloaded so...
|
by: Quasar |
last post by:
Hi Gents,
I'm trying to tune our DBs using the Desing Advisor feature. I'm
interested just in the indexes area.
Following the IBM infocenter I came to this page:...
|
by: aj |
last post by:
DB2 LUW 8.1 fixpak 14
Red Hat EL AS 4.4
I'm trying to diagnose some nocturnal CPU pressure, and am trying to
understand the dynamic statement cache as it applies to LUW. The only
doc/redbooks...
|
by: WT |
last post by:
Hello,
I have a dictionary made with objects which contain a control element, the
control element is added to a Page when I want to edit the dictionary
content.
I put this dictionary in cache...
|
by: Damir |
last post by:
Hello!
I have noticed that after (sucessfully) executing the command:
FLUSH PACKAGE CACHE DYNAMIC
the dynamic SQL statement cache is not completely cleared (some of the
dynamic SQL statement...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |