function _facebook_pull_notes_cached in Facebook Pull 7
Same name and namespace in other branches
- 6 facebook_pull.module \_facebook_pull_notes_cached()
- 7.3 facebook_pull.module \_facebook_pull_notes_cached()
- 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 211
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 > time()) {
$data = _facebook_pull_notes($id, $key, $viewer);
cache_set($cache_key, $data, 'cache', CACHE_TEMPORARY);
}
else {
$data = $cache->data;
}
return $data;
}