Search the Community
Showing results for tags 'cache'.
-
I am using php require to input a page of code. I am including (require) that file several times within the page. I am guessing that it executes the file every time, and does not save any page loading time, and in fact probably slowing it down because it has to make the request every time. Just wanted an expert to confirm or deny my educated guess. Would it be the same if it were including an html file instead of a php file? <?php require ("$base_path/main_page_rotation/content4.php"); ?>
- 1 reply
-
- php require
- php include
-
(and 1 more)
Tagged with:
-
What's the best way to cache things on the server? I've found some SetEnv things but this all seems to be a single key/value. I'd like to cache an array of things that I can access later. Right now it's cached in $_SESSION which is fine, but still there's overhead on every first-time visitor to a site. Is there a way to add something to $_SERVER or elsewhere that ALL visitors to a website will ultimately be able to access? I guess I want something like web.config in C#, where the first time a page is visited, the "app starts", as it were, and those things are now in cache on the server. What's the best way to do this?
- 21 replies
-
Hi I just have a question about the caching code below. Should the date function be in the filename if I want to cache the file for several days? Or if the date changes will a new file be created and used instead of the the previous cache file. Is that not even used since my if statement checks for the file modification time? Thanks for the help in understanding this. $cachefile = 'cache/cached/'.$id . date('M-d-Y').'.php'; $cachetime = 172800; // Check if the cached file is still fresh. If it is, serve it up and exit. if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) { include($cachefile); exit; } ob_start(); {HTML TO CACHE} $fp = fopen($cachefile, 'w'); fwrite($fp, ob_get_contents()); fclose($fp); // finally send browser output ob_end_flush(); I basically want to cache a file for 2-3 days.
-
I have a website in which I use php, and at one point I tried some MySQL on there and, unfortunately, MySQL seems to be my Achilles' heel; It's less complicated by far than most languages, yet I still can't seem to wrap my head around it. There is no MySQL anywhere in any file on my local system, which is the only place the site exists so far. I will paste the code if necessary. My main question is, has anyone experienced something like this? I read about the "ghost" SQL (Jesus, Destiny, etc.) but that seems more of a prank or an "act of God" (as defined by some insurance companies) rather than a cache or browser/ source issue... Right? I am relatively new to php in depth, but have much experience using it simply, such as with including files or other light tasks like math or small "game elements" (for games which otherwise do not exist
-
I have a website where I allow people to submit a .pdf file and it is then displayed in an iframe or in a pdf object in a div. The names of the files always stay the same, and are uploaded to a specific folder. Problem is- when they upload a new .pdf file....the browser always displays the old .pdf file. Deleting temp files- doesn't change. <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> does not work Is there a way to make sure that the current and updated pdf file gets served to the browser and it displays it? Any suggestions would help. Andy
-
Hi All I have a site that is takinga bunch of feeds from other sites, normalising the data into a product file. I also have a "Google" like search engine that a user can use to searh this data and get desired results. I have nearly 1m products and it takes 1 user only approximately 10 seconds to search the data even though its thoroughly indexed. I heard putting the data in cache would be far quicker. Is this true? The size of the data is just under 600mb so i have plenty of RAM. If this is true can someone please point me in the right direction to upload it in the cache and search on it. Many thanks