protected static function RestfulBase::addCidParams in RESTful 7
Get the cache id parameters based on the keys.
Parameters
$keys: Keys to turn into cache id parameters.
Return value
array The cache id parameters.
1 call to RestfulBase::addCidParams()
- RestfulBase::generateCacheId in plugins/
restful/ RestfulBase.php - Generate a cache identifier for the request and the current context.
File
- plugins/
restful/ RestfulBase.php, line 108 - Contains RestfulBase.
Class
- RestfulBase
- Class \RestfulBase
Code
protected static function addCidParams($keys) {
$cid_params = array();
foreach ($keys as $param => $value) {
// Some request parameters don't affect how the resource is rendered, this
// means that we should skip them for the cache ID generation.
if (in_array($param, array(
'__application',
'filter',
'loadByFieldName',
'page',
'q',
'range',
'sort',
))) {
continue;
}
// Make sure that ?fields=title,id and ?fields=id,title hit the same cache
// identifier.
$values = explode(',', $value);
sort($values);
$value = implode(',', $values);
$cid_params[] = substr($param, 0, 2) . ':' . $value;
}
return $cid_params;
}