Jump to content

Search the Community

Showing results for tags 'cache'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 54 results

  1. I'm using "quiet" saving in the Webmention module and was wondering if that prevents the page's cache from being cleared. I'm just using the built-in page caching with the option "Clear cache for saved page only (default)" If it matters, the page-save I'm calling is specifying the Webmention Field, rather than just $page->save(); For reference, the code is https://github.com/gRegorLove/ProcessWire-Webmention/blob/master/Webmention/Webmention.module#L840
  2. We have a big selector which we have broken down into 3 chunks to return a list of notes (pages) with repeaters as follows. We also allow the user to filter the results. The problem we have is that the page currently takes nearly 10 seconds to process results. Is there anything we can do to improve the performance of this? I wonder if it would be worth bringing the filters into each of the find()s. I assume that caching here wouldn't work due to querystring parameters? $selector = "template=horse-note"; // Notes with unread comments (date order, most recent first) $notes_with_unread_comments = $pages->find("{$selector}, h_notes_comments.count>0, h_notes_comments.{$session->unread_by}>0, sort=h_notes_last_comment"); //echo 'Notes with unread comments ('.count($notes_with_unread_comments).'):<br />'.$notes_with_unread_comments.'<br /><br />'; // Unread notes (date order, most recent first) $notes_unread = $pages->find("{$selector}, {$session->unread_by}>0, sort=h_notes_last_comment"); //echo 'Notes unread ('.count($notes_unread).'):<br />'.$notes_unread.'<br /><br />'; // Read notes in date order (most recent first) that they were either added or that the last comment was made, whichever is most recent. $notes_other = $pages->find("{$selector}, sort=-h_notes_last_comment"); //echo 'Notes other ('.count($notes_other).'):<br />'.$notes_other.'<br /><br />'; // create notes PageArray $notes_total = new PageArray(); $notes_total->add($notes_other); $notes_total->prepend($notes_unread); $notes_total->prepend($notes_with_unread_comments); // FILTER // sanitize inputs $horse = $sanitizer->text($input->get->horse); $category = $sanitizer->int($input->get->category); $from_date = $sanitizer->text($input->get->from_date); $to_date = $sanitizer->text($input->get->to_date); $comments = $sanitizer->int($input->get->comments); // horse name if($horse) { $selector .= ", parent.h_name%=$horse"; } // note category if($category) { $selector .= ", h_notes_category_id=$category"; } // from date if($from_date) { $selector .= ", h_notes_last_comment>=".strtotime("$from_date 00:00:00"); } // to date if($to_date) { $selector .= ", h_notes_last_comment<=".strtotime("$to_date 23:59:59"); } // comments if($comments) { $selector .= ", h_notes_comments.count>0"; } // apply filter if($selector!='template=horse-note') { $notes_total = $notes_total->find($selector); } // slice PageArray according to pageNum $pageNum = $input->pageNum; $limit = 15; $start = ($pageNum-1)*$limit; $notes = $notes_total->slice($start, $limit);
  3. I'm working on a site that is using the Goodreads API but I'm finding the page very slow to render so would like to speed it up by cacheing the output of the API. The page is made up of several child page 'bundles' each of which displays a selection of books which are chosen with a repeating field containing ISBN numbers. $goodreads_api = 'xxxxxx'; foreach($page->children as $bundle) : foreach($bundle->goodreads as $goodreads) : $xml_string = file_get_contents('https://www.goodreads.com/search/index.xml?key='.$goodreads_api.'&q='.$goodreads->isbn); $book_xml = new SimpleXMLElement($xml_string); foreach ($book_xml->search->results->work as $book) : // content goes here endforeach; endforeach; endforeach; I've looked at the Markup Cache module but when I try cacheing the second foreach loop, I get the correct number of bundles and the correct number of books, but same output for every book. If I cache the first foreach, I get the correct number of bundles, but only one book and again, the same content for each bundle. So is Markup Cache the way to go, and if so, what am I doing wrong, or if not, what else should I be looking at?
  4. Hi, recently I launched a site, where some templates have an enabled cache. Now I made some changes in the css file and noticed, that only if the cache is disabled, the css changes are visible in the frontend. I'm using the AIOM+ module. Is this a normal behavior?
  5. Hi there, I am using the following template file to provide a pdf download, of a pdf stored in a file-field. <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); If template caching is disabled, everything working as expected and the following header is sent HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:03:27 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Disposition: attachment; filename="anyfile.pdf" Content-Length: 909233 X-XSS-Protection: 1; mode=block Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Content-Type: application/pdf Using Template cache the header is overwritten by HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:06:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-XSS-Protection: 1; mode=block Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Any ideas to prevent this?
  6. I’ve got a site that’s hosted in a shared environment. When I try to use ProcessWire’s caching, content changes in the admin are not reflected on the front-end. Turning off cache, resolves it immediately. Doing some research, I found this message on another thread: According to my hosting company with regards to their set-up: So my question is if there’s anything I can do to get ProcessWire’s caching working in my case. None of the cache options (page-level, site level, etc. ) work in my case.
  7. Hi, I don't know if this is the right section for this but I collected some thoughts and a kind of manual about how to increase the performance of your website under load with nginx and fastcgi_cache. At best, this could be a kind of ProCache for nginx users, as not everyone is using Apache and thus not able to use ProCache on their sites. Additionally, this solution comes with the benefit of server side mobile detection and selective caching. http://svn.matthiashaak.com/website-performance-with-processwire-nginx-and-fastcgi_cache/ Please let me know your thoughts or questions about this. Be aware however, that with this solution you end up serving static pages, so no hooks or PHP functions will be called. I am currently working on a module that eases the cache purging, so kindly be patient if you need this. "Wait, and thou shalt receive"
  8. Setup: PW version 2.7.1 dev template cache is disabled Chrome Canary is opened with disabled cache and in inkognito view mode When I make a change to a template file (say the basic home.php) I want to immediately see that change after refreshing the browser. Example: This is the content of home.php: <?php echo "bla"; I browse to the root page and see the "bla" output. I change the code to <?php echo "bla1"; and save the file. After that I immediately reload the page in the browser and I don’t see the change to "bla1". Only after multiple browser reloads (at times also more than 20 reloads) and "hard" reloads does the change appear. What I tried to do: set $config->dbCache, $config->sessionFingerprint and $config->sessionChallenge to false in config.php delete all sessions re-save the page in the ProcessWire backend and reload the browser page completely delete the browser history (cookies, cache, everything) after the first visit to the page Nothing helped. Questions: Can someone replicate this behavior? What can I do to achieve the desired behavior? Thanks a lot in advance for any help.
  9. Hello, I worked with PW 2.6.15 dev and I've just updated to 2.6.22. My templates are configured with a cache enabled. When I update a page content, visitors don't see any change, I see my changes just if i'm logged. I understand that the cache is used only for guest, it's my choice in the configuration panel (guests only). It's not a problem of navigator cache, i have disabled it for my tests. But how to make the page cache cleared when I save my page? Thanks for your help.
  10. Hi all, Keen on processwire. Thanks a lot for this thing! But here is my issue: I have a lot of pages that need to be cached. But the content on this pages depends on what user has in his session's variable (not a logged-in user, just a guest but with a different session's variable value). So I need to add this session variable as a cache key before page will have been rendered and created the cache file. How to do so? I tried to find the solution, but there is no Hooks in wire/core/CacheFile.php So, my thoughts: 1. add the Hook for method "buildFilename" in wire/core/CacheFile.php to have the possibility to change filename for cache file (or at least to add custom cache key for filename) or 2. somehow do it using addHookBefore('Page::render' For example: let's assume we have a special param like $options['custom_cache_key'] and we can change it inside Hook method (by the way how to do that?)
  11. Hi Guys, I wanted to reach to everyone in the community to see if someone has come across this issue. We have a client that had a website built in PHP. We provided our client with a new website built on ProcessWire. Our client has their domain name registered with register.com and their old website was built by another developer who was hosting the website in a virtual server at gandi.net. The DNS settings were as follows: Domain name was pointed to the gandi.net in order to display the website files. The MX records were pointed to Google servers for company emails. The Name servers were as is which is the stock register.com name servers. We were not able to speak with the old developer to setup a time to update the files so we were asked by our client to move forward without contacting the old developer. How we setup the new website: In order to avoid down time of the email accounts and not having to setup new MX records on another host, we simply setup our clients new website on GoDaddy shared hosting and changed the A record in their register.com DNS settings to point to the new hosting account. Basically, an IP change. Everything else they had stayed the same, meaning we did not change the MX records and we did not change the name servers. Here is the issue: Some website visitors are seeing the new website, some are seeing the old website. We first thought it was due to browser caching or the propagation did not fully complete when they tried to visit the website. After telling our client to wait until the new DNS settings or try to clear their cache, we thought they were all good to go. Now our client is contacting us saying that the issue is still happening. So we contacted register.com and had them resubmit the new DNS settings again, basically the same IP change we did. Result: Some users are still seeing the old website on certain routers. We are also seeing the old website on certain routers we use and the new site on other routers. Can anyone provide some guidance? Has anyone seen this issue before? We even pinged the website and it shows the correct server, we also used whatsmydns.net to see what the site is coming up as across the world and we also see the correct server. Lastly, we sent the url to our partners in Germany and they see the new website and not the old one. This is honestly the oddest issue I have seen and unsure as to why this is going on? Here is our clients site: medstarlab.com
  12. Hi all! i have noticed that if enable the cache (for example on homepage), if I switch language the page is always the same, so i imagine that cache file is the same for any language. I wonder if there is any option that can save one cache file for each language. Alessio
  13. Hey mates, when setting up template caching, we are able to define "Cache disabling GET variables". While this is very useful, I would like to propose the ability to define "Cache forking GET variables". The given variables (and their combinations) would then create seperate cache files for different values. Basicly, whenever we use GET/POST parameters in our application, we are not able to serve cached content, while there are lots of situations where it would make sense. I think that this is a mayor caching mechanism in general. The performance impact should be minimal, but I smell a little security problem: I/O impact could get interresting, if someone bombards your site with requests with random values for known variables. I have no clue how the big caching engines out there manage this problem. Any ideas? Please discuss Cheers BTW: Does someone know how processwire handles the caching with url segments and page numbers? Never tried...
  14. I was wondering what the best (fastest/lesses computing power) aproach in using PW API variables inside the $cache function call? (not actual code) Example 1 echo $cache->get("example-1", function($user,$page,$pages) {} Example 2 echo $cache->get("example-2", function() use($user,$page,$pages) {} Example 3 echo $cache->get("example-3", function() { $user = wire('user'); $page = wire('page'); $pages = wire('pages'); }
  15. Hi, I wrote a little function for get last modified date from pages. What is this function making ? You can get last modified page modified date from given id, parent or from all pages. What can you do with last modified date? You can use it for caching pages. Here is little function and some example usages. /** * Get last modified page modified date from given $id, $parent_id, $templates_id or from all * * @param bool $id * @param bool $parent_id * @param bool $templates_id * @return mixed|string */ function getLastModified($id=false, $parent_id=false, $templates_id=false) { if(!is_null($id)) { $where = ""; if(is_bool($id) != true) { $where = " WHERE"; $where .= ($parent_id) ? " parent_id = {$id}" : " id={$id}"; $where .= ($templates_id) ? " AND templates_id = {$templates_id}" : ""; } $results = wire('db')->query("SELECT MAX(modified) as modified FROM pages{$where}"); if($results->num_rows > 0) { $result = $results->fetch_assoc(); $search = array(' ', '-', ':'); $replace = array('', '', ''); return str_replace($search, $replace, $result['modified']); } } return ""; } Gist : https://gist.github.com/trk/a9d7e01ecfa6e40b65bcExample Usages : <?php echo $cache->get("top-navigation" . getLastModified(true), function($pages) { echo renderYourNavigation(); }); ?> Here we are checking all pages and getting last modified date from database. With this way you don't need a cache time. If you update any page from your site, your cache file will be updated also. <?php echo $cache->get($page->name . getLastModified($page->id), function($page) { echo $page->title; // Do what you want... }); ?> With this usage : you can use $page->name + last modified date as cache name and you page will be cached and to be updated always.. <?php echo $cache->get('news-' . getLastModified(1234, true), function($pages) { $pages->get(1234); // Print out your news... }); ?> If you set second parameter as "true" function will check pages if have parent_id = 1234.
  16. Playing around with the markup cache on a website which is listing accommodation/activities. The page in question displays a number of listings (info about accommodation operator) and then a google map with markers for all the listings. I've cached (using markup cache) each listing, and also the google map markers, and the performance boost from this is pretty damn good, I'm stoked with the result. In the process I've got a bit obsessed with page-load speed and done some benchmarks. the following image is a sample page-load. The troubling aspect is time PW takes to get up and running. As you can see from the benchmarking info the vast majority of page-load time is PW startup - that is everything prior to the page template - ie, the time is measured from the start of index.php to the start the the page template file. Is this normal? This is on a live server (shared host) and the value varies from 400-600ms. Do installed modules have any impact on this? Is there any way to speed this up? It's reasonably snappy but if this can be improved then I'm all for it
  17. Hi, i want to build a simple tracking system, where i can see how the users navigate through my site. Right now i insert a row in a custom db-table with a unique id, the page a user visits, the page the user came and a timestamp. I do this with a after-hook to »ProcessPageView:finished«, which is setup in an _init.php template which is prepend to any other template. This works fine. The problem is that this doesn't work on cached templates/pages. How can I use the template-cache-feature AND update my db-table via this hook or any other technique? Thanks!
  18. Hey, I am running a php script to batch upload images to existing pages. It works fine. However, I had a problem with a few incorrectly named pages, so I updated them via the admin area. Seems fine. Checked the database and the changes are OK. Problem is that when I run the script now the changes are not picked up. In other words it is falling over at precisely the same place using the old file name. I am just calling them (via browser or via terminal with wire) using $wire->pages->find("parent=/fabrics/"); for instance. It feels like a caching problem in pw? Any help appreciated.
  19. I've got a cron job that bootstraps processwire as shown in https://processwire.com/api/include/ It watches pages in a loop (auctions happening live) and checks fields periodically. while(true) { wire('pages')->uncacheAll(); $auction = wire('pages')->get($auction_id); It appears that without the uncacheAll(), changes to the page (changes made external to this script) aren't picked up by the get(). Is this the best way to assure I don't get cached pages? I found this method by looking at wire/core/Pages.php and didn't see a way to invalidate a certain page or pass an option to get that says to avoid any caching.
  20. Hi, I've come across this issue for the first time and am wondering if anyone else has a better solution than what I've come up with. I have a site that uses PHP to sniff the user agent and redirect if it finds one that matches with mobile. Like this: $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $winmo = strpos($_SERVER['HTTP_USER_AGENT'],"Windows Phone"); $opera_mini = strpos($_SERVER['HTTP_USER_AGENT'],"Opera Mini"); $android_mobile = false; if(stripos($_SERVER['HTTP_USER_AGENT'],"Android") && stripos($_SERVER['HTTP_USER_AGENT'],"mobile")){ $android_mobile = true; } $is_mobile = 0; if($iphone || $ipod || $android_mobile || $winmo || $opera_mini) { $is_mobile = 1; } $is_ipad = 0; if($ipad) { $is_ipad = 1; } if($is_mobile) { header("location: m/"); } However, I'd like to use caching on templates that have this detection and have found (not surprisingly of course) that the redirection doesn't happen when caching is enabled - everyone gets served the desktop content. I could use a JavaScript based solution, but that would not be ideal as part of the page would render before the user would be redirected. Just wondering if anybody has any other ways to solve this problem. Would ProCache solve this? Thanks.
  21. Thought I would share the following experience here for anyone interested in caching in PW. Converting a site from modx (Evo) to PW and finding some interesting performance issues. One page which pulls in content from 50 other pages ran really well under modx, page load (uncached) was around 450ms (yeah, not that fast but a lot of database action and formatting happening there). Converted the site to to PW and it took a massive hit, loading in around 3200ms. I was surprised as I always though PW was supposed to be lightning fast. It's possible (probable?) I'm doing something with $pages which is not well optimized, not sure at this stage but will look more into this when I get a moment. Anyway, I found two parts which were taking the longest to process and coded MarkupCache to these areas. Never used it before but found it very easy and nice to work with and just works beautifully, superb, all credit to the developer. The result of this quick bit of optimising was a page load speed reduced from 3200 to around 600ms. Impressive. And so easy to manage. While on the topic; There are several options for caching in PW, including template caching, markupcache, and procache. There's bit's and pieces on the forums about each, but is there a writeup somewhere summarising pros and cons of each? I was thinking of trying out template caching or even better ProCache but the site is probably too dynamic. Analytics, counters, live stats on the pages, etc. so I'm thinking it will be not so good yeah? Any advice welcome.
  22. Hi guys, is there a simply way to hook directly into ProcessWire build-in page cache (not markup cache)? I will code a module to use memcache(d) as an alternative to build-in filesystem based page cache. So, i need to bypass the page cache function, but i can't find any hook for this. Regards, Dave
  23. Hello All, I've added a "Random Articles" block to the bottom of our article pages, at The Significato Journal. The block is under the headline at the bottom, called: "More Headlines You May be Interested In" I have some questions: a) Is my code efficient and the best method to display 4 random headlines? It's of special concern if a site eventually has tens of thousands of articles, because I'm creating an array of all of the articles pages, and then grabbing 4 random ones. It would be better, I think, if I could create an array of only 4, but I don't see how I can do that and still randomly select from all of them. Here's my code: $random_selectors = "custom_template_file.select_value=article_page.php," . "publish_date<=$now, headline_image_name!="; $random_keys = wire('pages')->find("$random_selectors"); $random_pages = $random_keys->findRandom('4'); echo "<table width='100%' cellpadding='0' cellspacing='10'><tr>"; foreach ( $random_pages as $random_page ) { # ... display headline and image } echo "</tr></table>"; b) Every time I reload an article, the headlines change, which is what I want. Does this break the 1-day template cache on the article, or does the headline block get passed through, with the rest of the page still cached? I'd like to keep the cache running. Here's a sample url, so that you can see it in action: http://significatojournal.com/columns/culture-of-heart/the-living-compass-of-kindness-and-compassionate-love/ Thanks for any feedback! Peter
  24. Hi all, I'm trying to improve performance on one of the ProcessWire sites my agency manages, and having some problems with it. The template that the page below has a cache setting of 86400, with the default sub-settings (clear only the changed page, etc.) However, when I look at the Request headers I see that Cache-Control is set to max-age=0, and in the Response headers Cache-Control is set to no-store, no-cache, must-revalidate, post-check=0, pre-check=0, Expires is set to Thu, 19 Nov 1981 08:52:00 GMT and Pragma is set to no-cache. Am I missing something about how template caching works? Thanks. http://schools.saltmoney.org/content-pages/responsible-borrower-program-a-proactive-approach-to-student-debt-and-delinquency/
  • Create New...