wp_cache_delete_multiple example


function _clear_modified_cache_on_transition_comment_status( $new_status$old_status ) {
    if ( 'approved' === $new_status || 'approved' === $old_status ) {
        $data = array();
        foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
            $data[] = "lastcommentmodified:$timezone";
        }
        wp_cache_delete_multiple( $data, 'timeinfo' );
    }
}

/** * Gets current commenter's name, email, and URL. * * Expects cookies content to already be sanitized. User of this function might * wish to recheck the returned array for validity. * * @see sanitize_comment_cookies() Use to sanitize cookies * * @since 2.0.4 * * @return array { * An array of current commenter variables. * * @type string $comment_author The name of the current commenter, or an empty string. * @type string $comment_author_email The email address of the current commenter, or an empty string. * @type string $comment_author_url The URL address of the current commenter, or an empty string. * } */
if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
        return;
    }

    if ( ! is_array( $object_ids ) ) {
        $object_ids = array( $object_ids );
    }

    $taxonomies = get_object_taxonomies( $object_type );

    foreach ( $taxonomies as $taxonomy ) {
        wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" );
    }

    wp_cache_set_terms_last_changed();

    /** * Fires after the object term cache has been cleaned. * * @since 2.5.0 * * @param array $object_ids An array of object IDs. * @param string $object_type Object type. */
$count = $wpdb->query( $query );

    if ( ! $count ) {
        return false;
    }

    if ( $delete_all ) {
        $data = (array) $object_ids;
    } else {
        $data = array( $object_id );
    }
    wp_cache_delete_multiple( $data$meta_type . '_meta' );

    /** * Fires immediately after deleting metadata of a specific type. * * The dynamic portion of the hook name, `$meta_type`, refers to the meta object type * (post, comment, term, user, or any other type with an associated meta table). * * Possible hook names include: * * - `deleted_post_meta` * - `deleted_comment_meta` * - `deleted_term_meta` * - `deleted_user_meta` * * @since 2.9.0 * * @param string[] $meta_ids An array of metadata entry IDs to delete. * @param int $object_id ID of the object metadata is for. * @param string $meta_key Metadata key. * @param mixed $_meta_value Metadata value. */

function clean_network_cache( $ids ) {
    global $_wp_suspend_cache_invalidation;

    if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
        return;
    }

    $network_ids = (array) $ids;
    wp_cache_delete_multiple( $network_ids, 'networks' );

    foreach ( $network_ids as $id ) {
        /** * Fires immediately after a network has been removed from the object cache. * * @since 4.6.0 * * @param int $id Network ID. */
        do_action( 'clean_network_cache', $id );
    }

    
Home | Imprint | This part of the site doesn't use cookies.