Title: WP_REST_URL_Details_Controller::get_cache
Published: February 3, 2022
Last modified: August 20, 2026

---

# WP_REST_URL_Details_Controller::get_cache( string $key ): mixed

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Utility function to retrieve a value from the cache at a given key.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#parameters)󠁿

 `$key`stringrequired

The cache key.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#return)󠁿

 mixed The value from the cache.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#source)󠁿

    ```php
    private function get_cache( $key ) {
    	return get_site_transient( $key );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php#L453)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php#L453-L455)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#related)󠁿

| Uses | Description | 
| [get_site_transient()](https://developer.wordpress.org/reference/functions/get_site_transient/)`wp-includes/option.php` |

Retrieves the value of a site transient.

  |

| Used by | Description | 
| [WP_REST_URL_Details_Controller::parse_url_details()](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/parse_url_details/)`wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php` |

Retrieves the contents of the title tag from the HTML response.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_url_details_controller/get_cache/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_url_details_controller%2Fget_cache%2F)
before being able to contribute a note or feedback.