Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: request for way to disable caching of xprofile data for get_all_for_user

@cwjordan

Participant

John,

Thanks. I’m sure caching that data speeds things up in normal use, however I do regularly need to export all the extended profile fields, and it doesn’t make sense to try and cache that.

What exactly do you need to know? I’ve got 13302 users, with roughly 115 extended profile fields (many of which tend to be blank for a given user). My little test script is below, although what I actually use is the “Export User Data” plugin.

<?php
/*
Template Name: test template
*/

?>

<h2>TEST of BP_XProfile_ProfileData::get_all_for_user</h2>
<?php
global $bp;
$start_time=microtime(true);
$memory_use = memory_get_usage(true) / 1024 / 1024;
echo "<br/>Start Memory Use = $memory_use  MB";
for ($userid = 1; $userid <= 5000; $userid++) {
        BP_XProfile_ProfileData::get_all_for_user($userid);
}
$times_run = $userid -1;
$finish_time = microtime(true);
$elapsed_time = $finish_time - $start_time;
$avg_time = $elapsed_time / $times_run;
echo "<br/>Ran get_all_for_user for $times_run users";
echo "<br/>Elapsed time = $elapsed_time seconds";
echo "<br/>Avg time = $avg_time seconds";
$memory_use = memory_get_usage(true) / 1024 / 1024;
echo "<br/>End Memory Use = $memory_use  MB";
echo "</p>";
?>
Skip to toolbar