Files
ulthon_admin/extend/base/common/tools/StoreValueToolsBase.php

36 lines
799 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace base\common\tools;
use think\helper\Arr;
/**
* 全局数据存储工具.
*
* 可以在当前生命周期内,存储一些全局数据,
* 相比SESSION性能更高但是只能在当前生命周期内使用常驻内存服务时除外
*
* @mixin Arr
*/
class StoreValueToolsBase
{
protected static $store = [];
public static function set($key, $value)
{
return Arr::set(static::$store, $key, $value);
}
public static function get($key, $default = null)
{
return Arr::get(static::$store, $key, $default);
}
public static function __callStatic($name, $arguments)
{
$arguments = array_merge([static::$store], $arguments);
return call_user_func_array([Arr::class, $name], $arguments);
}
}