shared memory
1.0.0
php shared memory operation implementation. based on
linux/maclinux/mac/windowsFunction:
写入读取删除释放of shared memoryShmMap implements an array structure based on shared memory (array operation, pop/push, iterator, read/get it automatically locks). {
"require" : {
"php-comp/shm" : " dev-master "
}
}git clone https://github.com/php-comp/shared-memory.git // github use PhpComp Shm ShmFactory ;
use PhpComp Shm ShmMap ;
$ shm = ShmFactory:: make ([
' key ' => 1 ,
' size ' => 512
]);
$ shm -> write ( ' data string ' );
$ ret = $ shm -> read ();
var_dump ( $ ret );
$ shmAry = new ShmMap ([
' key ' => 2 ,
' size ' => 512
]);
$ shmAry [ ' one ' ] = ' val1 ' ;
$ shmAry [ ' two ' ] = ' val2 ' ;
$ shmAry -> set ( ' three ' , ' val3 ' );
var_dump ( $ shmAry [ ' three ' ], $ shmAry -> getMap ());
unset( $ shmAry [ ' two ' ]);
var_dump ( $ shmAry -> getMap ());MIT