How do I cache a custom module that has points?
Yes, you can use the Drupal cache API to set and get the data from cache.

Assuming D7, The following resources have some good information on that:


https://www.lullabot.com/articles/a-beginners-guide-to-caching-data-in-drupal-7
https://www.drupal.org/docs/7/managing-site-performance-and-scalability/caching-to-improve-performance/caching-overview


For example:

function MYMODULE_function() {
  global $user;
  $user_point_data = &amp;drupal_static(__FUNCTION__ . $user-&gt;uid);
  if (!isset($user_point_data)) {
    // User per user cache id for points.
    $cid = 'user_point_data:' . $user-&gt;uid;
    if ($cache = cache_get($cid)) {
      $user_point_data = $cache-&gt;data;
    }
    else {
      // Do your expensive calculations here, and populate $user_point_data
      // with the correct stuff..
      cache_set($cid, $user_point_data, 'cache');
    }
  }
  return $user_point_data;
}


You can then clear the cached data, based on specific user id or all items, with: 

cache_clear_all

// Clear all user point data from cache
cache_clear_all('user_point_data', 'cache', TRUE);
// Clear specific user point data from cache
$cid = 'user_point_data:' . $GLOBALS['user']-&gt;uid;
cache_clear_all($cid, 'cache');