Tag Info

Hot answers tagged

7

When and how to use transients or the object cache is a bit tricky and site-dependent. Here's the breakdown: When not using a persistent object cache (like memcached): Transients are stored in the database Objects in the object cache are only cached for the duration of the page request. When using a persistent object cache (like memcached): Transients ...


6

WordPress, by default, does a form of "Object Caching" but its lifetime is only a single page load. Options are actually a really good example of this. Check out this answer for more info. The summary: A page starts All options are loaded with a simple SELECT option_name, option_value from $wpdb->options statement Subsequent requests for those options ...


5

For development I would advise to always work with WP_DEBUG set to true and do the following: $key = 'transient_key'; if( !WP_DEBUG && ( false !== ($transient = get_transient($key)) ){ /* Generate transient manually */ $expiration = 24*60*60;//How long to keep for set_transient($key,$transient, $expiration); } In general - it should be ...


5

Catching the weather API remote data The msg, you're showing in your question is basically the result from the weather API. And it says, that there's no data available for your location. The first thing you want to do is some research in the Codex and the "WP HTTP API". The right/WP way to grab remote data After you've learned about the WP HTTP API, ...


4

take a look at WordPress Transients API which offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted. The transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the ...


4

I would not be storing 50+ meg as a transient. I would look into storing it in the filesystem somehow, or creating my own specific db table to store the data. Consider that if you're storing the transient in the database, then every time you pull it, that's 50 meg of data that has to be sent from the DB to the webserver for processing. And that's 50 meg of ...


3

Another solution would be to use an ordered list. $my_query = new WP_Query($args); if ( $my_query->have_posts() ) : echo '<ol style="list-style:decimal">'; while( $my_query->have_posts() ) : $my_query->the_post(); echo '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>'; ...


3

Transient API works in WordPress out of the box and does not require any plugin. However installing special object cache drop in can change it's back-end implementation. Typically for keeping data in memory rather than database and improving its performance. Like rainbows and unicorns. "against" is not clear in your question. No. Full page caching plugins ...


3

Is this ok or should I just store it in an array form so I can just directly access it without using json_decode? In your case store it directly means store it serialized. Because $data is an array and cannot be stored as is, but converted to a string. Even if you access it directly like: $data = get_transient('amazon_items'); print_r( $data[0] ); ...


3

Although both of your options (that is, using transients or using a cron job) are viable, I'm a fan of using transients unless the dataset is exceptionally large or if there is some need to automate the process. Without seeing much of your current code, it's difficult to give a working example. Nonetheless, if you end up going the route of transients, I'd ...


3

I find that W3 Total Cache works well for me in doing minifying and gzipping. (I'm not sure about the others.) More generally, if there's a plugin that does something, I use the plugin. It's very rare to see a do-it-all theme do something better than a specialized, single-function plugin, particularly when that plugin is of the caliber of W3 Total Cache.


3

You should not cache anything in the admin so your examples are correct. A typical nginx reverse proxy cache is set to ignore wp\-.*\.php|wp\-admin Another option is to not cache logged in users by checking the wp cookies, but you probably don't have that level of control. ps. It is highly advisable you test this out before flipping the switch. tl;dr You ...


3

I recommend you to read this article W3 Total Cache -Plugin: The Complete Settings Guide, it's a great tutorial to manually setup your w3tc. And when you saving your settings remember to flush your cache because if you don't Google Pagespeed will test it on the old cached files.. You can try to add this .htaccess rules: ## EXPIRES CACHING ## <IfModule ...


2

What permissions should I set on each of wp folders? Users will need to upload various assets (images, pdfs, office docs, audio, video). I found this article here that seems helpful, but would like to get some input from folks having done this? This will be the same as any other web server. Whatever user happens to be running the web server need ...


2

there are 4 cache types that I know of Trivial - It is always on and takes affect before any other caching comes into play. It stores the cached items in an php array which means that it consumes memory from your php execution session, and that the cache is emptied after php execution is over. i.e. even without using any other cache if you call ...


2

I find that relying on the filesystem to cache results is easy for maintenance, diagnostics, and performance. Please note that this might be true in some (maybe even most) circumstances, but not all of them. If your code is meant for anything beyond personal usage you don't know with which file system and hardware will it be used and how will it perform ...


2

In short yes ... I'm using it on my own multisite with about 7 subsites and its working fine. If you have many users, then this probably a good choice as it can be activated per blog. It also has a great deal of integration for CDN, minify and and control over the caching headers.


2

W3TC does diffenet things, among which are: caching database queries; implementing object cache (which transients use). These are two entirely separate processes. Caching individual database queries with transients doesn't make much sense with or without memcached and W3TC involved. Transients are best used for fragment caching final result of operation ...


2

We use it with great success with about 2 million page views of traffic monthly and it relieves a great deal of stress from our servers. As others have mentioned, its configurability is also a plus allowing you to control which sites use it or not. Our experience is using IIS so your mileage may vary if you're using Apache or ngix


2

I use W3TC, so these are approaches that I can come up with it for it: Fragment caching to exclude that part of page, will reduce cache effectiveness overall. Identify page with switched stylesheet by query argument, disable caching of such pages. Identify page with switched stylesheet by URL endpoint, disable caching of such by mask. Implement stylesheet ...


2

Turns out the answer is fairly simple (at least for WP Supercache). Use either PHP or legacy caching (ie not mod_rewrite) Turn on late init (either from the UI - recommended, or by setting $wp_super_cache_late_init = 1; in wp-content/wp-cache-config.php Use the <!--dynamic-cached-content--> directive to wrap the content that should remain dynamic. ...


2

It looks like your site is doing a lot of processing when displaying a page. have you tried adding a caching mechanism? you can give plugin a try: http://wordpress.org/extend/plugins/w3-total-cache/


2

The communication with the server happens via Ajax. I once wrote a high-level overview of Ajax in WordPress, but you can find many more examples on this site and around the web. Next, you have to do a query that will find similar titles. I found some questions that might help you on Stack Overflow: Suggestion For Finding Similar Rows In Mysql Display ...


2

The problem is not with the 'transients' function. That looks like an error message returned from your third party API. You probably need to check that before you use set_transient. set_transient will insert whatever it is given and get_transient will retrieve whatever is in the DB. In other words, I am fairly sure the problem is not where you think it is. ...


2

This works fine for me as db-error.php in wp-content: Delete the mailer block if you don't want it <?php header('HTTP/1.1 503 Service Temporarily Unavailable'); ?> <?php $to = "me@mysite.com"; $subject = "My Database is down"; $message = "My Database is down"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; ...


2

Did you already try adding all the mobile user agents to the "Rejected user agents" list in w3tc? I use this list for this purpose (not created by me and certainly not complete but enough for my purpose): iphone ipod ipad aspen incognito webmate android dream cupcake froyo blackberry9500 blackberry9520 blackberry9530 blackberry9550 blackberry9800 webos ...


1

Here is the mfunc part in the 0.9.2.9 version of the W3TC plugin: http://plugins.trac.wordpress.org/browser/w3-total-cache/tags/0.9.2.9/lib/W3/PgCache.php#L1386 where the regular expression is: $buffer = preg_replace_callback('~<!--\s*mfunc\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->(.*)<!--\s*/mfunc\s*' . W3TC_DYNAMIC_SECURITY . '\s*-->~Uis', ...


1

I got like 8,000 posts so it's def. not the problems. However, you may want to optimize your WordPress setup a bit. APC (opcode caching) w3tc (caching plugin) For $5 plan hosting on DigitalOcean (ref link), I was able to host a WordPress site with 8,000 posts and ~ 180,000 page views per day; with the above simple setup. Also, you may want to take a ...


1

Your issue is not as much priming (which only happens first time) but that cache refreshes in solution you are using are synchronous. Transients API is not dealing with updates by itself, it is handled by code that calls it. So it doesn't implement async updates. On other hand there is nothing that prevents implementing async on top of it. It can be done ...


1

Some of caching APIs in WordPress, including transients, can make use of swappable Object Cache backend. There are ready-made implementations around for it which use file system as storage engine. However determining if it's worth it is another matter entirely. In usual case database is very likely to outperform disk for typical caching tasks. However there ...



Only top voted, non community-wiki answers of a minimum length are eligible