Scalr\Modules\PlatformFactory::warmup PHP Method

warmup() public static method

Clears static cache
public static warmup ( )
    public static function warmup()
    {
        self::$cache = [];
    }

Usage Example

コード例 #1
0
ファイル: di.php プロジェクト: sacredwebsite/scalr
    }
    $serviceid = 'logger' . (!empty($params[0]) ? '.' . $params[0] : '');
    if (!$cont->initialized($serviceid)) {
        $cont->setShared($serviceid, function ($cont) use($params) {
            return new \Scalr\Logger(!empty($params[0]) ? $params[0] : null);
        });
    }
    return $cont->get($serviceid);
});
$container->set('warmup', function ($cont, array $arguments = null) {
    //Releases cloud credentials
    foreach (['aws', 'openstack', 'cloudstack', 'eucalyptus', 'cloudyn'] as $srv) {
        $cont->release($srv);
    }
    //Releases platform module static cache
    \Scalr\Modules\PlatformFactory::warmup();
    return $cont;
});
$container->set('crypto', function ($cont, array $arguments = []) {
    $algo = array_shift($arguments) ?: MCRYPT_RIJNDAEL_128;
    $mode = array_shift($arguments) ?: MCRYPT_MODE_CFB;
    $cryptoKey = $cryptoKeyId = array_shift($arguments) ?: APPPATH . "/etc/.cryptokey";
    $keySize = array_shift($arguments) ?: 32;
    $blockSize = array_shift($arguments) ?: 16;
    if ($cryptoKey instanceof SplFileObject) {
        $cryptoKeyId = $cryptoKey->getRealPath();
    } else {
        if (is_resource($cryptoKey) && get_resource_type($cryptoKey) == 'stream') {
            $cryptoKeyId = realpath(stream_get_meta_data($cryptoKey)['uri']);
        } else {
            if ((is_string($cryptoKey) || is_numeric($cryptoKey)) && @file_exists($cryptoKey)) {