设置缓存
@param string $alias 别名
@param string $value 缓存内容
@param array $config 配置
@return bool
16737
public function set($alias, $value, $config = array())
	{
		$ttl = isset($config['ttl']) ? $config['ttl'] : 0;
		return xcache_set($alias,$value,$ttl);
	}
1165728
public static function alias($name, $alias = null)
    {
        // get real name for $id
        if (null === $alias) {
            return self::resolveAlias($name);
        }

        foreach ((array)$alias as $aliasName) {
            if (!isset(self::$aliases[$aliasName])) {
                self::$aliases[$aliasName] = $name;
            }
        }

        return true;
    }
1081136
public function exists($alias, $config = array())
	{
		$tableName = $this->cache->parseField($this->tableName);
		$key = $this->cache->parseField('key');
		return 0 < $this->cache->queryValue(<<<SQL
select 1 from {$tableName} where {$key} = %s
SQL
,array($alias));
	}
57783
public function set($name, $value = '', $option = null) {
        // 参数设置(会覆盖黙认设置)
        if (!is_null($option)) {
            if (is_numeric($option)) {
                $option = ['expire' => $option];
            }
            elseif (is_string($option)) {
                parse_str($option, $option);
            }
            $config = array_merge($this->config, array_change_key_case($option));
        }
        else {
            $config = $this->config;
        }
        $name = $config['prefix'] . $name;
        // 设置cookie
        if (is_array($value)) {
            array_walk_recursive($value, 'self::jsonFormatProtect', 'encode');
            $value = 'nb:' . json_encode($value);
        }
        $expire = !empty($config['expire']) ? Request::ins()->requestTime + intval($config['expire']) : 0;
        $this->response->cookie($name, $value, $expire, $config['path'], $config['domain'], $config['secure'], $config['httponly']);
        $this->request->cookie[$name] = $value;
    }
833737
public function set($alias, $value, $config = array())
	{
		$ttl = isset($config['ttl']) ? $config['ttl'] : 0;
		return apc_store($alias,$value,$ttl);
	}
731374
protected function buildClause(string $name, $value, string $operator, string $alias = null): string
    {
        $table = $alias === 't' || $alias === null
            ? $this->query->getTable()
            : $this->query->getJoins()[$alias]['table'];

        $sqlName  = $alias !== null ? "$alias.`$name`" : "`$name`";
        $sqlValue = $this->prepareValue($value, $this->connection->metadata()->getFieldType($table, $name));

        return "$sqlName $operator $sqlValue";
    }
1355957
public function config_write($name, $value) {
        global $DB, $USER, $CFG;

        if ($this->nosave) {
            return true;
        }

        // make sure it is a real change
        $oldvalue = get_config($this->plugin, $name);
        $oldvalue = ($oldvalue === false) ? null : $oldvalue; // normalise
        $value = is_null($value) ? null : (string)$value;

        if ($oldvalue === $value) {
            return true;
        }

        // store change
        set_config($name, $value, $this->plugin);

        // Some admin settings affect course modinfo
        if ($this->affectsmodinfo) {
            // Clear course cache for all courses
            rebuild_course_cache(0, true);
        }

        $this->add_to_config_log($name, $oldvalue, $value);

        return true; // BC only
    }
1321989
function setConfig( $config, $value ) {
    switch( strtoupper( $config )) {
      case 'ALLOWEMPTY':
        $this->allowEmpty = $value;
        break;
      case 'FORMAT':
        $value   = trim( $value );
        $this->format = $value;
        break;
      case 'LANGUAGE':
         // set language for calendar component as defined in [RFC 1766]
        $value   = trim( $value );
        $this->language = $value;
        break;
      case 'NL':
        $this->nl = $value;
        break;
      case 'UNIQUE_ID':
        $value   = trim( $value );
        $this->unique_id = $value;
        break;
    }
  }
252896
protected function filterConfig(string $name, $value = null)
    {
        $class = 'filterConfig' . ucfirst($name);
        if (method_exists($this, $class) === true) {
            $value = call_user_func([$this, $class], $value);
        }
        return $value;
    }
626549
public function get($alias, $default = false, $config = array())
	{
		$tableName = $this->cache->parseField($this->tableName);
		$key = $this->cache->parseField('key');
		$expire = $this->cache->parseField('expire');
		$time = time();
		$result = $this->cache->query(<<<SQL
select * from {$tableName} where {$key} = %s and ({$expire} = 0 or {$expire} >= {$time})
SQL
,array($alias));
		if(isset($result['key']))
		{
			return $result['value'];
		}
		else
		{
			return $this->parseDefault($default);
		}
	}
172544
public static function model($alias, $params = [], $config = [])
    {
        //$module = static::getInstance(); // built-in - get only from loaded modules
        $module = static::instance();
        if (!empty($module)) {
            return $module->getDataModel($alias, $params, $config);
        }
    }
1233263
public static function validateStrEqI($value, $equalsValue, $reason = null, $alias = 'Parameter')
    {
        if (is_string($value)) {
            if (strcasecmp($value, $equalsValue) === 0)
                return $value;
            $isTypeError = false;
        } else
            $isTypeError = true;

        if ($reason !== null)
            throw new ValidationException($reason);

        if ($isTypeError) {
            $error = self::getErrorTemplate('Str');
            $error = str_replace('{{param}}', $alias, $error);
        } else {
            $error = self::getErrorTemplate('StrEqI');
            $error = str_replace('{{param}}', $alias, $error);
            $error = str_replace('{{value}}', $equalsValue, $error);
        }
        throw new ValidationException($error);
    }
1328743
public static function alias(&$config, $key, $alias){
		if(!isset($config[$alias]))
			return;
		$tmp = & $config;
		foreach(explode('.', $key) as $key){
			$tmp = & $tmp[$key];
		}
		if(!isset($tmp))
			$tmp = $config[$alias];
	}
593475
public static function set($name,$value=null)
    {
        if(is_array($name)){
            self::$config=array_merge(self::$config,$name);
            return;
        }
        if(strstr($name,'.')===false){
            self::$config[$name]=$value;
        }else{
            list($l,$r)=explode('.',$name);
            self::$config[$l][$r]=$value;
        }
    }
1012164
public function set_config($config, $value = null)
	{
		$config = is_array($config) ? $config : array($config => $value);
		foreach ($config as $key => $value)
		{
			if (strpos($key, '.') === false)
			{
				$this->config[$key] = $value;
			}
			else
			{
				\Arr::set($this->config, $key, $value);
			}
		}

		return $this;
	}
993211
public static function setAlias(string $alias, string $path = null)
    {
        if ($alias[0] !== '@') {
            $alias = '@' . $alias;
        }

        // Delete alias
        if (!$path) {
            unset(self::$aliases[$alias]);

            return;
        }

        // $path 不是别名，直接设置
        if ($path[0] !== '@') {
            self::$aliases[$alias] = $path;

            return;
        }

        // $path是一个别名
        if (isset(self::$aliases[$path])) {
            self::$aliases[$alias] = self::$aliases[$path];

            return;
        }

        list($root) = explode('/', $path);
        if (!isset(self::$aliases[$root])) {
            throw new \InvalidArgumentException('The set root alias does not exist，alias=' . $root);
        }

        $rootPath  = self::$aliases[$root];
        $aliasPath = str_replace($root, '', $path);

        self::$aliases[$alias] = $rootPath . $aliasPath;
    }
1122302
public function setWasConverterUsed($value, $alias = null)
    {
        if ($alias) {
            $this->converterAliasUsed[$alias] = (bool) $value;
        } else {
            $this->converterUsed = (bool) $value;
        }
    }