bp_core_set_incremented_cache( string $key, string $group, array $ids )

Caches a value using an incremented key.

Description

An "incremented key" is a cache key that is hashed with a unique incrementor, allowing for bulk invalidation.

Use this method when caching data that should be invalidated whenever any object of a given type is created, updated, or deleted. This usually means data related to object queries, which can only reliably cached until the underlying set of objects has been modified. See, eg, BP_Activity_Activity::get().

Parameters

$key

(Required) Unique key for the query. Usually a SQL string.

$group

(Required) Cache group. Eg 'bp_activity'.

$ids

(Required) Array of IDs.

Return

(bool)

Source

File: bp-core/bp-core-cache.php

function bp_core_set_incremented_cache( $key, $group, $ids ) {
	$cache_key = bp_core_get_incremented_cache_key( $key, $group );
	return wp_cache_set( $cache_key, $ids, $group );
}

Changelog

Changelog
Version Description
BuddyPress 2.7.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.