Title: Custom Caching Code Compatibility with Auto-Optimize
Last modified: July 29, 2024

---

# Custom Caching Code Compatibility with Auto-Optimize

 *  Resolved [hassantafreshi](https://wordpress.org/support/users/hassantafreshi/)
 * (@hassantafreshi)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/)
 * As the developer of the [Easy Form Builder plugin](https://wordpress.org/plugins/easy-form-builder/),
   I’m seeking advice on potential conflicts with Auto-Optimize.
 * Here’s the function I’m using for internal caching:
 *     ```wp-block-code
       public function get_efbFunction($state) {    if (isset($this->efbFunction)) return $this->efbFunction;    $efbFunctionInstance;    if (false === ($efbFunctionInstance = wp_cache_get('efbFunctionInstance', 'emsfb'))) {        if (!class_exists('Emsfb\efbFunction')) {            require_once(EMSFB_PLUGIN_DIRECTORY . 'includes/functions.php');        }        $efbFunctionInstance = new \Emsfb\efbFunction();        wp_cache_set('efbFunctionInstance', $efbFunctionInstance, 'emsfb', 3600); // 1 hour cache    }    $this->efbFunction = $efbFunctionInstance;    if ($state == 1) return $this->efbFunction;}
       ```
   
 * I’m concerned that using `wp_cache_get` and `wp_cache_set` for internal caching
   might cause conflicts with Auto-Optimize. Has anyone encountered similar issues
   or know of best practices to ensure compatibility?
 * Any guidance or insights would be greatly appreciated.
 * Thank you for your help!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-caching-code-compatibility-with-auto-optimize%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/#post-17920299)
 * These are WordPress functions which I suspect would be used by every caching 
   plugin. We would recommend that you don’t use more than one plugin to do your
   caching. The only exception to this would be if you had a plugin to do your object
   cache such as Redis or Varnish.
 *  Thread Starter [hassantafreshi](https://wordpress.org/support/users/hassantafreshi/)
 * (@hassantafreshi)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/#post-17920533)
 * Thank you for your response. Why should I not use these two functions?
    -  This reply was modified 1 year, 10 months ago by [hassantafreshi](https://wordpress.org/support/users/hassantafreshi/).
 *  [wpmansour](https://wordpress.org/support/users/wpmansour/)
 * (@wpmansour)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/#post-17922510)
 * Using `wp_cache_get` and `wp_cache_set` for internal caching generally shouldn’t
   cause conflicts with WP-Optimize.
 * The `wp_cache_set` functions are used for object caching, which helps reduce 
   HTML page generation time by storing resource-intensive results, such as complex
   database query results. On the other hand, WP-Optimize is a file caching plugin
   that saves the generated HTML page and avoids regenerating it for every request.
 * If you are specifically referring to potential conflicts with Auto-Optimize, 
   it might be best to post in their support channels to get more targeted advice
   for that plugin.
 *  Thread Starter [hassantafreshi](https://wordpress.org/support/users/hassantafreshi/)
 * (@hassantafreshi)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/#post-17930310)
 * Thank you for your explanation. We have not conducted any tests yet and are sending
   this message to consider various possibilities with the development version. 
   We want to understand how it might potentially conflict with your plugin.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom Caching Code Compatibility with Auto-Optimize’ is closed to new
replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

## Tags

 * [question](https://wordpress.org/support/topic-tag/question/)

 * 4 replies
 * 3 participants
 * Last reply from: [hassantafreshi](https://wordpress.org/support/users/hassantafreshi/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/custom-caching-code-compatibility-with-auto-optimize/#post-17930310)
 * Status: resolved