/** * @group bp_update_meta_cache */ public function test_bp_update_meta_cache_with_cache_misses() { // Use activity just because $a1 = $this->factory->activity->create(); // Confirm that all activitymeta is deleted global $wpdb; $bp = buddypress(); $wpdb->query($wpdb->prepare("DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $a1)); bp_update_meta_cache(array('object_ids' => array($a1), 'object_type' => 'activity', 'cache_group' => 'activity_meta', 'meta_table' => buddypress()->activity->table_name_meta, 'object_column' => 'activity_id')); $this->assertSame(array(), wp_cache_get($a1, 'activity_meta')); }
/** * Slurp up activitymeta for a specified set of activity items. * * It grabs all activitymeta associated with all of the activity items passed * in $activity_ids and adds it to the WP cache. This improves efficiency when * using querying activitymeta inline. * * @param int|str|array $activity_ids Accepts a single activity ID, or a comma- * separated list or array of activity ids */ function bp_activity_update_meta_cache($activity_ids = false) { global $bp; $cache_args = array('object_ids' => $activity_ids, 'object_type' => $bp->activity->id, 'object_column' => 'activity_id', 'cache_group' => 'activity_meta', 'meta_table' => $bp->activity->table_name_meta, 'cache_key_prefix' => 'bp_activity_meta'); bp_update_meta_cache($cache_args); }
/** * Slurps up groupmeta * * This function is called in two places in the BP_Groups_Group class: * - in the populate() method, when single group objects are populated * - in the get() method, when multiple groups are queried * * It grabs all groupmeta associated with all of the groups passed in $group_ids and adds it to * the WP cache. This improves efficiency when using groupmeta inline * * @param int|str|array $group_ids Accepts a single group_id, or a comma-separated list or array of * group ids */ function bp_groups_update_meta_cache($group_ids = false) { global $bp; $cache_args = array('object_ids' => $group_ids, 'object_type' => $bp->groups->id, 'object_column' => 'group_id', 'meta_table' => $bp->groups->table_name_groupmeta, 'cache_key_prefix' => 'bp_groups_groupmeta'); bp_update_meta_cache($cache_args); }
/** * Slurp up metadata for a set of messages. * * It grabs all message meta associated with all of the messages passed in * $message_ids and adds it to WP cache. This improves efficiency when using * message meta within a loop context. * * @since 2.2.0 * * @param int|string|array|bool $message_ids Accepts a single message_id, or a * comma-separated list or array of message ids. */ function bp_messages_update_meta_cache($message_ids = false) { bp_update_meta_cache(array('object_ids' => $message_ids, 'object_type' => buddypress()->messages->id, 'cache_group' => 'message_meta', 'object_column' => 'message_id', 'meta_table' => buddypress()->messages->table_name_meta, 'cache_key_prefix' => 'bp_messages_meta')); }
/** * Slurp up blogmeta for a specified set of blogs. * * It grabs all blogmeta associated with all of the blogs passed * in $blog_ids and adds it to the WP cache. This improves efficiency when * using querying blogmeta inline. * * @param int|string|array|bool $blog_ids Accepts a single blog ID, or a comma- * separated list or array of blog IDs. */ function bp_blogs_update_meta_cache($blog_ids = false) { $cache_args = array('object_ids' => $blog_ids, 'object_type' => buddypress()->blogs->id, 'object_column' => 'blog_id', 'cache_group' => 'blog_meta', 'meta_table' => buddypress()->blogs->table_name_blogmeta); bp_update_meta_cache($cache_args); }
/** * Slurp up metadata for a set of notifications. * * It grabs all notification meta associated with all of the notifications * passed in $notification_ids and adds it to WP cache. This improves efficiency * when using notification meta within a loop context. * * @since 2.3.0 * * @param int|string|array|bool $notification_ids Accepts a single notification_id, or a * comma-separated list or array of * notification ids. */ function bp_notifications_update_meta_cache($notification_ids = false) { bp_update_meta_cache(array('object_ids' => $notification_ids, 'object_type' => buddypress()->notifications->id, 'cache_group' => 'notification_meta', 'object_column' => 'notification_id', 'meta_table' => buddypress()->notifications->table_name_meta, 'cache_key_prefix' => 'bp_notifications_meta')); }