ifacethoughts

page_cache

WordPress uses page_cache global variable to cache static pages by their ID. Caching can notably improve performance by retrieving data from memory and avoiding repeated queries to the database. It is an array set in the function update_page_cache(&$pages) defined in [wordpress root folder]/wp-includes/functions.php.

WordPress uses page_cache internally in the functions to retrieve pages:

  • get_pages($args = ''): retrieves the static pages according to the arguments provided. Following arguments are supported:
    • child_of: if specified, the function retrieves the children of specified page ID.
    • sort_column: attribute of the page that should be used for sorting, which is implemented as column name in the wp_posts table in the database.
    • sort_order: order for sorting, currently supports ASC and DESC.
    • exclude: includes IDs of pages that should be excluded from the retrieval.
  • get_page_children($page_id, $pages): retrieves child pages of the specified page. If $pages argument is empty, $page_cache global variable is used.

Plugin and theme developers can use page_cache to write custom functions which involve retrieving page data.

Back to full list of global variables.

Technorati tags: ,

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    [...] $page_cache [...]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.