Object Cache Pro

Customizations

Dashboard widget

By default the dashboard widget is visible to all users with the rediscache_manage capability. In some scenarios you might want to hide the dashboard widget, or restrict access to certain roles.

/**
* Remove the Object Cache Pro dashboard widget.
*/

add_action( 'wp_dashboard_setup', function () {
remove_meta_box( 'dashboard_rediscachepro', 'dashboard', 'normal' );
}, 20 );

Automatic drop-in updates

By default the object cache drop-in will be kept up-to-date, unless DISALLOW_FILE_MODS is set to true. You can alter this behavior using the file_mod_allowed filter.

/**
* Disable automatic object cache drop-in updates.
*/

add_filter( 'file_mod_allowed', function ( $file_mod_allowed, $context ) {
if ( $context === 'object_cache_dropin' ) {
return false;
}

return $file_mod_allowed;
}, 10, 2 );

Drop-in validation

In some rare scenarios you might wish to disable the drop-in validation or drop-in version check. You can do so with the rediscache_validate_dropin and rediscache_validate_dropin_version filters.

/**
* Force the object cache drop-in to be valid.
*/

add_filter( 'rediscache_validate_dropin', '__return_false' );

/**
* Force object cache drop-in version to be up-to-date.
*/

add_filter( 'rediscache_validate_dropin', '__return_false' );

Filesystem health check

One of the plugin’s health checks tests for filesystem access to ensure the object-cache.php drop-in can be seamlessly updated.

This health check temporarily creates a .object-cache-test.tmp file in WP_CONTENT_DIR. To disable this health check you can use the rediscache_check_filesystem filter.

/**
* Disable filesystem health check.
*/

add_filter( 'rediscache_check_filesystem', '__return_false' );