Add logic to automatically select the best caching strategy

Based on the number of unique shared strings as well as the available memory amount,
one strategy will be chosen over the other.
The algorithm is based on empirical data and super safe so it may need to be tuned.
This commit is contained in:
Adrien Loison committed 2015-07-14 02:26:01 -07:00
1 parent 334f7087da
commit 494c506d56
5 files changed
+248 -5

No files matched your search

+23
View File
@@ -89,4 +89,27 @@ class ReflectionHelper
return $value;
}
/**
* Invoke a the given public or protected method on the given object.
*
* @param object $object
* @param string $methodName
* @param *mixed|null $params
*
* @return mixed|null
*/
public static function callMethodOnObject($object, $methodName)
{
$params = func_get_args();
array_shift($params); // object
array_shift($params); // methodName
$className = get_class($object);
$class = new ReflectionClass($className);
$method = $class->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $params);
}
}