Skip to content

进程间变量共享组件,用于分布式数据共享

Notifications You must be signed in to change notification settings

walkor/GlobalData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GlobalData

进程间数据共享组件,用于分布式数据共享。服务端基于Workerman。客户端可用于任何PHP项目。

服务端

use Workerman\Worker;
require_once __DIR__ . '/../../Workerman/Autoloader.php';
require_once __DIR__ . '/../src/Server.php';

$worker = new GlobalData\Server('127.0.0.1', 2207);

Worker::runAll();

客户端

require_once __DIR__ . '/../src/Client.php';

$global = new GlobalData\Client('127.0.0.1:2207');

var_export(isset($global->abc));
$global->abc = array(1,2,3);
var_export($global->abc);
unset($global->abc);
var_export($global->abc);
$global->abc = array(1,2,3);
var_export($global->abc);
var_export($global->cas('abc', array(1,2,3), array(5,6,7)));
var_export($global->abc);

About

进程间变量共享组件,用于分布式数据共享

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages