function _ctools_export_get_some_defaults

Get a limited number of default objects.

This attempts to load the objects directly from cache. If it cannot, the cache is rebuilt. This does not disturb the general get defaults from cache object.

This function should ONLY be called if default caching is enabled. It does not check, it is assumed the caller has already done so.

2 calls to _ctools_export_get_some_defaults()
ctools_export_load_object in includes/export.inc
Load some number of exportable objects.
ctools_get_default_object in includes/export.inc
Get the default version of an object, if it exists.

File

includes/export.inc, line 782

Code

function _ctools_export_get_some_defaults($table, $export, $names) {
    foreach ($names as $name) {
        $keys[] = 'ctools_export:' . $table . ':' . $name;
    }
    $data = cache_get_multiple($keys, $export['default cache bin']);
    // Cache hits remove the $key from $keys by reference. Cache
    // misses do not. A cache miss indicates we may have to rebuild.
    if (!empty($keys)) {
        return _ctools_export_get_defaults($table, $export);
    }
    // Now, translate the returned cache objects to actual objects.
    $cache = array();
    foreach ($data as $cached_object) {
        $cache[$cached_object->data->{$export['key']}] = $cached_object->data;
    }
    return $cache;
}