Title: Create custom methods
Last modified: March 14, 2023

---

# Create custom methods

 *  Resolved [earphanb](https://wordpress.org/support/users/earphanb/)
 * (@earphanb)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/create-custom-methods/)
 * What is the best way to create custom code for wp_cache_add and wp_cache_set 
   method to prevent to be deleted after update?

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

 *  Plugin Support [pwtyler](https://wordpress.org/support/users/pwtyler/)
 * (@pwtyler)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/create-custom-methods/#post-16559361)
 * [@earphanb](https://wordpress.org/support/users/earphanb/), are you looking for
   a hook/action that doesn’t exist?
 *  Thread Starter [earphanb](https://wordpress.org/support/users/earphanb/)
 * (@earphanb)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/create-custom-methods/#post-16562090)
 * object-cache.php is symlink (dropin) on script with same name in plugin directory,
   but I need to attach some prefix on keys in cache record and I change dropin 
   script in wp-config directory to do that. After plugin update my code is overwrited
   because of symlink.
 *  What is a proper way to do this and change original functionality of wp_cache_set
   and wp_cache_add methods?
 *  Plugin Support [pwtyler](https://wordpress.org/support/users/pwtyler/)
 * (@pwtyler)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/create-custom-methods/#post-16567362)
 * Instead of symlinking, you can copy the source file to `wp-content/object-cache.
   php` and then make your changes— any future plugin updates would not overwrite
   the `object-cache.php` file outside of the plugin directory.
 * I don’t expect `object-cache.php` to change too often (it most recently did to
   fix PHP 8.2 compatibility), but you will want to keep an eye on future releases
   changing `object-cache.php` which would no longer be applied.
 * If you have a sense of how you might achieve your changes to object-cache.php
   using hooks/actions, you might also fork the plugin and open a PR to [https://github.com/pantheon-systems/wp-redis/](https://github.com/pantheon-systems/wp-redis/)
 *  Plugin Contributor [John Spellman](https://wordpress.org/support/users/jspellman/)
 * (@jspellman)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/create-custom-methods/#post-16642457)
 * Closing this issue.

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

The topic ‘Create custom methods’ is closed to new replies.

 * ![](https://ps.w.org/wp-redis/assets/icon-256x256.png?rev=3417699)
 * [WP Redis](https://wordpress.org/plugins/wp-redis/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-redis/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-redis/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-redis/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-redis/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-redis/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [John Spellman](https://wordpress.org/support/users/jspellman/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/create-custom-methods/#post-16642457)
 * Status: resolved