Title: Add Transient Caching
Last modified: August 22, 2016

---

# Add Transient Caching

 *  [hexalys](https://wordpress.org/support/users/hexalys/)
 * (@hexalys)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/add-transient-caching/)
 * Had a major issue with cURL requests on one server resulting in fatal errors,
   which is never good… It produces [this error](https://wordpress.org/support/topic/fatal-error-cannot-use-object-of-type-wp_error-as-array-in-?replies=1)
   a result of failing wp_remote_get.
    To address this and do it more properly, 
   the plugin should most definitely use transient caching instead of making the
   request for every page. Consider also that the Vimeo API has a hit rate limit,
   a very busy site could have issues.
 * So here are my changes (currently in production) for plugin update’s consideration:
 *  //$videos_result = wp_remote_get($vmg_videos_url);
    //$vmg_videos = simplexml_load_string(
   $videos_result[‘body’]); if (false === ($videos_result = get_transient(‘vmg_videos’))){
   if ($videos_result = wp_remote_retrieve_body( wp_remote_get($vmg_videos_url) )){
   set_transient(‘vmg_videos’, $videos_result, 7200);//2 hours } } $vmg_videos =
   $videos_result ? simplexml_load_string($videos_result) : false;
 *  ///$info_result = wp_remote_get($vmg_info_url);
    //$vmg_info = simplexml_load_string(
   $info_result[‘body’]); if (false === ($info_result = get_transient(‘vmg_info’))){
   if ($info_result = wp_remote_retrieve_body( wp_remote_get($vmg_info_url) )){ 
   set_transient(‘vmg_info’, $info_result, 7200);//2 hours } } $vmg_info = $info_result?
   simplexml_load_string($info_result) : false;
 * [https://wordpress.org/plugins/vimeo-channel-gallery/](https://wordpress.org/plugins/vimeo-channel-gallery/)

The topic ‘Add Transient Caching’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/vimeo-channel-gallery.svg)
 * [Vimeo Channel Gallery](https://wordpress.org/plugins/vimeo-channel-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/vimeo-channel-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/vimeo-channel-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/vimeo-channel-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/vimeo-channel-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/vimeo-channel-gallery/reviews/)

## Tags

 * [caching](https://wordpress.org/support/topic-tag/caching/)
 * [channel](https://wordpress.org/support/topic-tag/channel/)
 * [gallery](https://wordpress.org/support/topic-tag/gallery/)
 * [transient](https://wordpress.org/support/topic-tag/transient/)
 * [vimeo](https://wordpress.org/support/topic-tag/vimeo/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)
 * [wp_remote_get](https://wordpress.org/support/topic-tag/wp_remote_get/)

 * 0 replies
 * 1 participant
 * Last reply from: [hexalys](https://wordpress.org/support/users/hexalys/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/add-transient-caching/)
 * Status: not resolved