You are here

public static function CacheHelper::setMultiple in Helper 7

A copy of cache_set() that allows multiple values to be set at once.

Parameters

array $data: An array of values to cache, keyed by the cache ID of the data to store (cid).

string $bin: The cache bin to store the data in.

int $expire: The expiration value to pass to cache_set().

File

lib/CacheHelper.php, line 59

Class

CacheHelper

Code

public static function setMultiple(array $data, $bin = 'cache', $expire = CACHE_PERMANENT) {
  foreach ($data as $cid => $value) {
    cache_set($cid, $value, $bin, $expire);
  }
}