How to use cache set and get to store time cron ran?
I don't think there is something wrong on cache_get() and cache_set(). It seems a logic problem. In your code the cache is never set if a cache is not found.



/**
 * Implements hook_cron().
 */
function mymodule_cron() {
  $data = '';

  if ($cache = cache_get('last-run')) {
    $data = $cache-&gt;data;
    if($data &lt;= strtotime('-1 day')) {
      //call helper function to perform some logic
      _some_func();
      //set update date in cache
      cache_set('last-run', time(), 'cache'));
    }
  }
  else {
    // set cache if there is no cache.
    cache_set('last-run', time(), 'cache'));
  }
}