Search the Community
Showing results for tags 'cache'.
-
Cacheable Placeholders This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there. Consider this simple example, where you want to output a custom greeting to the current user: <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale. This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this: <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook: // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github! Features A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links Github Repository & documentation Module directory If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!
-
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
-
module Cache Control - Clear all your caches in one place
MoritzLost posted a topic in Modules/Plugins
Process Cache Control This module provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions. The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu: Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Clear the ProCache page render cache (if your site is using ProCache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides: An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README. Plans for improvements If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind: Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions! Links https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory CHANGELOG in the repository Screenshots -
How to programmatically clear the page cache? I have a page that uses URL Segments. Based on the value of the URL Segment, the content of the page varies. From what I can see, the cache can handle it without a problem. But I have another question. I need to create an API that will clean the cache of selected pages - based on the value of URL Segments or some other value. Is there an API that will allow me to manage the page cache generated by PW?
-
Hy Processwire community, There are some problem in fileCompiler cache. when i change under the directory \site\templates\ it must change under the directory /site/assets/cache/FileCompiler/site/templates/ but it does not update and functionality working with /site/assets/cache/FileCompiler/site/templates/ directory. In this case please suggest me how i clear fileCompiler cache? what i have to clear it manually? Thanks AbdulQayyum.
- 3 replies
-
- processwire
- filecompiler
-
(and 1 more)
Tagged with:
-
Hello, I am using ProCache v3.1.8 on ProcessWire 3.0.96. Everything worked fine in the past, but today I noticed that the css file serverd by procache gives a 410 error. The file is there, I checked. I deleted the cached files, I deleted the css file, I looked into the .htaccess file looking for some clues about this problem but nothing worked. The only way i can see my website correctly again is disabling ProCache. Has anyone any clue on what could be the cause of the problem or on what should I do to fix it? Thanks!
-
Hi, I have a couple of restricted templates using the "Redirect to another URL" if the user doesn't have access. I redirect to a custom login page with the {id} tag. On successful login the user then gets redirected to the page he/she was trying to access in the first place (if the user in question has access to the page). You probably get the point. I now have a user who gets the "too many redirects" browser issue. I haven't been able to reproduce this so it's too early to draw any conclusions. Anyone else having similar issues? Also pw seems to always redirect with a HTTP 301 internally, i.e. the "Redirect to another URL" functionality, and these are cacheable in the browser (http://en.wikipedia.org/wiki/HTTP_301). PHP does however by default add headers that should make the browser not use cache: the no-store, no-cache, expires etc. This would effectively make the 301 (permanent redirect) behave like a 302 (temporary redirect), however the browsers have as far as I know have not been particularly good at following the recommendations regarding cache headers. Is there a reason for always using 301, in the pw core?
-
ProcessWire has builtin cache system (enabled per template basis). Why ProcessWire is not using HTTP headers Last-Modified and If-Modified-Since when cache is turned on? It seems that using this headers could increase performance and is quite easy to implement.
- 1 reply
-
- performance
- cache
-
(and 1 more)
Tagged with:
-
I had upgraded my Apache configuration to include PHP7.2 and PHP7.3 for a Laravel-based script on the same server. Somehow it/I messed up a previously fine Processwire site, in a very confusing way. The site still looks fine, but editing template files has no effect whatsoever. It is stuck on some kind of cached version. I have already disabled PHP7's OPcache, cleared browser caches, etc, with no effect. The pages now apparently come from PW's assets/cache/FileCompiler folder, even though I never enabled template caching for this site. I have tried adding "namespace ProcessWire;" to the top of the homepage template file, but then I get this fatal error: My functions.php file pulls data in from another Processwire installation on the same VPS with the following line: $othersitedata = new ProcessWire('/home/myaccount/public_html/myothersite/site/', 'https://myothersite.com/'); That apparently still works fine; the site still displays data from the other installation, but via the "cached" template that I am now unable to change. I don't know where to start with this mess. Does any of this sound familiar to anyone? Any pointers in the right direction would be much appreciated. Edit: Adding "$config->templateCompile = false;" to config.php results in the same fatal error as above.
- 1 reply
-
- cache
- filecompiler
-
(and 3 more)
Tagged with:
-
Hello, I'm started to play around with processwire. And I like it! My local dev system is up and runnig. I'm using the template factory with Twig. Anybody who use Twig and ProCache or is it possible to use both modules? Thanks in advance
-
I developed my own web store platform on ProcessWire. Work like a charm. However, I would like to know what is the best way to cache web store? There is a shopping cart, many languages and previously watched products which need to run without cache but everything else could be cached. Is there a way to use PW's own cache or ProCache for everything else except for certain HTML ID? I have used MarkupCache for categories in some cases. I'm addicted to speed. Everything has to be loaded as fast as possible or even faster. My next step is developing AMP HTML as part of the platform, but that is not helping normal version.
-
Hello everyone, Usually in many CMS database tables prefixed or suffixed with "cache" can be manually cleared without a problem because the system will populate them on the "next page request". Actually in Processwire I am expecting this behaviour: [On PW 3.x] Manually clear table "caches" in database Go to "client" side (not in the admin panel) All references to my "/site/modules" in my template files does not work : wire("modules")->get(""), $modules->get("") and modules()->get("") PHP error: Fatal error: Uncaught TypeError: Return value... My _init.php file are not able to find the references to my /site/modules/ The client side not working because this PHP fatal error. If I go to the admin panel "Admin -> Modules" and I trigger the action "Check for New Modules" in the top-right corner in the page, it populates the caches table with the required information and them the client side works. It is normal? Or I am doing something wrong ? A solution could be to manually call the script that the button "Check for New Modules" calls, but I want to know if I am doing something wrong here. Thank you in advance guys !
-
Hi all, Just wondering if its safe to delete the content of the cache table manually within the database?
-
I'm trying to understand how I could have users log in as "members", provide them with a customized experience, but still serve them cached pages? For example let's say I have 3 roles Guest Member SuperUser And let's say I have a NavBar type component that has a menu. Plus it has "log in!" if guest, or "logged in as Mike Smith" I would want guests to see a cached site with guest-only page access. Members should also see cached pages, but their menu may have access to members-only pages or fields or information. Furthermore they might have a "logged in as Mike Smith" element. SuperUsers can stay uncached. How does one go about creating that cache so that visitors aren't constantly re-creating the menu? Or that when "Sally Baker" logs in, she doesn't see a homepage that is cached for "Mike Smith" with all his elements? Thank you in advance for any replies.
-
hey guys, is there a way to prevent sections from caching? I am using a frontend login and when the user is logged in they can see extra content compared to the guest. I am using built-in template cache for certain templates and markup-cache for certain parts. Has the ProCache module any options to do that? The emergency solution is maybe turning off template cache and only use markup-cache except this dynamic content. many thanks!
-
Hey guys, i am using WireCache and template cache. Wondering if there is some kind of web crawler already for processwire which is crawling all your site to warm up the cache? (like in Shopware eCommerce you can warm up your cache with a crawler via cronjob, etc.) Would be a nice feature
-
I am currently designing a search page for my website. While I am able to get both pagination and fieldtype caching enabled separately, I am not able to implement them together. I followed the following 2 pages - https://processwire.com/api/modules/markup-pager-nav/ https://processwire-recipes.com/recipes/set-up-search-index-with-fieldtypecache/ Is there any way where I can combine these 2 methods for my website? Here is a snippet of my code $q = $sanitizer->text($input->get->q); $q = $sanitizer->selectorValue($q); // Search the cacged fields for our query text. // Limit the results to 50 pages. $selector = "search_cache~=$q, limit=50"; // If user has access to admin pages, lets exclude them from the search results. if($user->isLoggedin()) $selector .= ", has_parent!=2"; // Find pages that match the selector $matches = $pages->find($selector); //Get range of paginated results $start = $matches->getStart() + 1; $end = $matches->getStart() + count($matches); $total = $matches->getTotal(); $content = "<p><b>Showing search results ". $start . " - ". $end . " of ".$total."</b></p>"; // did we find any matches? if($matches->count) { $content .= '<ul>'; foreach($matches as $match){ $content .= '<li>'. $match->parent->title . ': <a href="' . $match->url . '">' . $match->title . '</a></li>'; } $content .= '</ul>'; $content .= $matches->renderPager(array( 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'nextItemLabel' => "Next", 'previousItemLabel' => "Previous", )); } else { // we didn't find any $content = "<strong>Sorry, no results were found.</<strong>"; }
- 1 reply
-
- fieldtype cache
- pagination
-
(and 2 more)
Tagged with:
-
Hi, I use TemplateFile class to render custom files like _layout.tpl (base html layout file), but output I think output isn't cached. Because there is no template added to PW I can't configure template cache I think. How to activate template cache inside of php code temporarily or persistent (for example with a hidden / system template created)? Should be done with code (module install or inside a php file).
-
Hi there, I'm experiencing a real weird caching issue with Safari (Desktop) and all mobile browsers where it is loading the old version of the site and refusing to reload the website. I don't seem to have the problem with Chrome where a reload did correctly reload the latest version of the website. Has anyone come across this issue before? Things I have tried (and failed) : 1) I've replaced our .htaccess file with the standard one that comes with Processswire 2.8 2) Everything here https://stackoverflow.com/questions/1922910/force-browser-to-clear-cache 3) Deleted everything under /assets/pwpc folder. 4) Deleted all local wesbite data on laptop/mobile and reloaded. Much appreciate if anyone can help me
-
I'm reusing pages depending on the url of the site and want to cache these pages. For example example.com/blog/1 and example.nl/blog/1 would use the same template but i'm extending the Page to limit the results depending on url. Is there a way that i can append a name to the cache name used to cache this page? It seems it should be easy to hook in the cache rending and change it but i could not find anything helpfull.
-
Hi, my server or processwire or me cancelled database, that don't exist and my server haven't backup. The error log is: http://www.permaculturaorganica.info/?/ Error: Exception: SQLSTATE[HY000] [1044] Access denied for user 'casbo_RdS'@'%' to database 'casbooko1_po' (in /data/vhosts/permaculturaorganica.info/httpdocs/wire/core/ProcessWire.php line 308) Is this log a log for database not found, it's correct? I was write any articles, but NOT PUBLISH, because the site haven't any grafic. Now I go in /site/assets/cache/ by ftp, but I don't see any file. The address is correct for find the files cache?
-
I'm caching a big loop (~1000 pages in a pagetable field) and i want to delete it when a new page is added and after that i want to recreate it with php to avoid users waiting for 10 seconds. I figured out the deletion part $path = $config->paths->assets."cache/MarkupCache/cache_name/"; if(file_exists($path)){ CacheFile::removeAll($path, true); } How can i rebuild the cache with php?
-
Hello, I'm working on a processwire based website in my local webserver (I don't have a lot of experience in processwire). I linked a new CSS file but no update on the website. I read some posts on the forum and decided to add $config->templateCompile = false; to my config.php to see if it was a compiler/cache issue. Then, white screen for all the pages even the admin pages. The only information I get is [HTTP/1.0 500 Internal Server Error 19ms] in the inspector console. I already tried to change back the config.php file or to add $config->debug=true; but nothing in the errors.txt. Any ideas ? Thank you
- 3 replies
-
- cache
- config.php
-
(and 1 more)
Tagged with:
-
I am having cache issues when working on template style using chrome browser at localhost with local server running. There are time color or size didn't change when I save css and reload chrome page. Sometimes to solve problem, I'd have to hit ctrl + alt + save to clear cache from browser. I've looked up Admin > Setup > Template > Cache Tab and noticed cache was already disabled as default. I have already looked into this article http://www.flamingruby.com/blog/processwire-caching-explained/ But realized it has nothing to with my issues and it got me confused rather its a browser or PW issues, does anyone have similar experience in past and probably found a solution? if so please share some suggestion. Thanks in advance.
-
Hi, I am writing a custom module that grabs external data via API calls. I would like to store this data as a temporary cache that gets refreshed every X minutes (API calls run in interval) What would be my options in terms of managing this cached data and where to store them? Thanks Rudy