You are here

public static function ShareaholicCache::get in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 cache.php \ShareaholicCache::get()

Get the cached item based on the key

Parameters

string $key the key to get the cache value for:

Return value

mixed the data cached or false if not found

2 calls to ShareaholicCache::get()
ShareaholicPublic::share_counts_api in ./public.php
Function to handle the share count API requests
ShareaholicUtilities::share_counts_api_connectivity_check in ./utilities.php
Share Counts API Connectivity check

File

./cache.php, line 22

Class

ShareaholicCache
A simple wrapper around the Drupal caching library because it is incapable of respecting the expire time

Code

public static function get($key) {
  $cache = cache_get($key);

  // check if the cache is stale
  if (!$cache) {
    return FALSE;
  }
  if (REQUEST_TIME > $cache->expire) {
    return FALSE;
  }
  return $cache->data;
}