You are here

function _facebook_pull_notes_cached in Facebook Pull 7.3

Same name and namespace in other branches
  1. 6 facebook_pull.module \_facebook_pull_notes_cached()
  2. 7 facebook_pull.module \_facebook_pull_notes_cached()
  3. 7.2 facebook_pull.module \_facebook_pull_notes_cached()

Pull the notes but check the cache first.

1 call to _facebook_pull_notes_cached()
facebook_pull_notes in ./facebook_pull.module
Serve up facebook notes.

File

./facebook_pull.module, line 217
Facebook Pull Module for getting content from Facebook graph.

Code

function _facebook_pull_notes_cached($id, $key, $viewer = 0) {
  $cache_key = sprintf("%s-%s-%s", $id, $key, $viewer);
  $cache = cache_get($cache_key);
  if (!$cache || $cache->created + FACEBOOK_PULL_CACHETIME < REQUEST_TIME) {
    $data = _facebook_pull_notes($id, $key, $viewer);
    cache_set($cache_key, $data, 'cache', CACHE_TEMPORARY);
  }
  else {
    $data = $cache->data;
  }
  return $data;
}