最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

performance - Preload external PHP information

programmeradmin2浏览0评论

I have pricing that I load from my billing system whmcs to my WordPress website using PHP.

I wanted to know if there is a way I can preload it for it to load nicely or cache only that page or something that will make the page just show without loading slowly.

Thanks

I have pricing that I load from my billing system whmcs to my WordPress website using PHP.

I wanted to know if there is a way I can preload it for it to load nicely or cache only that page or something that will make the page just show without loading slowly.

Thanks

Share Improve this question edited Jun 10, 2019 at 21:16 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Jun 10, 2019 at 21:07 Thovhakale MurendeniThovhakale Murendeni 111 bronze badge 2
  • How often is the pricing updated in your billing system? – ChristopherJones Commented Jun 10, 2019 at 21:29
  • @ChristopherJones Pricing is changed often. It links to the exchange rate. – Thovhakale Murendeni Commented Jun 12, 2019 at 10:50
Add a comment  | 

1 Answer 1

Reset to default 3

WordPress has Transient and Object Cache APIs available. In a default WordPress install, Transients are stored in the database while Object Cache is stored in memory for the duration of the request. You can change this configuration to using something like Redis, Memcache, or APC to store and access this faster.

In your case, you'd want to use Transients.

Here's a good example from the Transient API Codex:

<?php
// Get any existing copy of our transient data
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) {
    // It wasn't there, so regenerate the data and save the transient
     $special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' );
     set_transient( 'special_query_results', $special_query_results, 12 * HOUR_IN_SECONDS );
}

// Use the data like you would have normally...
?>
发布评论

评论列表(0)

  1. 暂无评论