You are here

function PMPAPIDrupal::cacheSet in Public Media Platform API Integration 7

Sets a cache value.

Parameters

string $key: The key of the value to be cached

string $value: The value to be cached

integer $lifetime: Lifetime of cache item (in seconds) or CACHE_PERMANENT or CACHE_TEMPORARY

Return value

Whatever cache_set might return

2 calls to PMPAPIDrupal::cacheSet()
PMPAPIDrupal::getDoc in classes/PMPAPIDrupal.php
Gets a doc from the PMP.
PMPAPIDrupal::pull in classes/PMPAPIDrupal.php
Pulls from the PMP.

File

classes/PMPAPIDrupal.php, line 259
Defines a class for PMP creation/transmission and retreival/parsing

Class

PMPAPIDrupal
@file

Code

function cacheSet($key, $value, $lifetime = CACHE_PERMANENT) {

  // Always save to cache - unless caching is turned off globally (not
  // recommended).
  if (variable_get('pmpapi_cache')) {
    if ($lifetime > 0) {
      $lifetime = REQUEST_TIME + lifetime;
    }
    return cache_set($key, $value, $this->cache_bin, $lifetime);
  }
}