Skip to content

Commit 3f555b6

Browse files
authored
集成组件到主仓库 (#86)
1 parent bbdd7b0 commit 3f555b6

File tree

12 files changed

+488
-488
lines changed

12 files changed

+488
-488
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/vendor
2-
/composer.lock
1+
/vendor
2+
/composer.lock

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2018 imiphp
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2018 imiphp
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 118 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,118 @@
1-
# imi-shared-memory
2-
3-
[![Latest Version](https://img.shields.io/packagist/v/imiphp/imi-shared-memory.svg)](https://packagist.org/packages/imiphp/imi-shared-memory)
4-
[![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg)](https://secure.php.net/)
5-
[![Swoole Version](https://img.shields.io/badge/swoole-%3E=4.1.0-brightgreen.svg)](https://github.com/swoole/swoole-src)
6-
[![IMI License](https://img.shields.io/github/license/imiphp/imi-shared-memory.svg)](https://github.com/imiphp/imi-shared-memory/blob/master/LICENSE)
7-
8-
## 介绍
9-
10-
基于 [Swoole Shared Memory](https://github.com/Yurunsoft/swoole-shared-memory) 开发的 `imi` 框架跨进程变量共享组件。
11-
12-
> 本仓库仅用于浏览,不接受 issue 和 Pull Requests,请前往:<https://github.com/imiphp/imi>
13-
14-
## Composer
15-
16-
本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 `composer.json` 中加入下面的内容:
17-
18-
```json
19-
{
20-
"require": {
21-
"imiphp/imi-shared-memory": "~1.0"
22-
}
23-
}
24-
```
25-
26-
然后执行 `composer update` 安装。
27-
28-
## 使用
29-
30-
在项目 `config/config.php` 中配置:
31-
32-
```php
33-
[
34-
'components' => [
35-
// 引入本组件
36-
'SharedMemory' => 'Imi\SharedMemory',
37-
],
38-
'pools' => [
39-
// 客户端连接池
40-
'sharedMemory' => [
41-
'async' => [
42-
'pool' => [
43-
'class' => \Imi\SharedMemory\Pool\ClientPool::class,
44-
'config' => [
45-
'maxResources' => 100,
46-
'minResources' => 0,
47-
],
48-
],
49-
'resource' => [
50-
// 以下为可选配置
51-
52-
// 存储器类型,注意和下面的类名不同
53-
// 'storeTypes' => [
54-
// \Yurun\Swoole\SharedMemory\Client\Store\KV::class,
55-
// \Yurun\Swoole\SharedMemory\Client\Store\Stack::class,
56-
// \Yurun\Swoole\SharedMemory\Client\Store\Queue::class,
57-
// \Yurun\Swoole\SharedMemory\Client\Store\PriorityQueue::class,
58-
// 'name' => 'XXXClass',
59-
// ],
60-
61-
// unix socket 文件名,默认会自动放 runtime 目录中
62-
// 'socketFile' => '',
63-
],
64-
],
65-
]
66-
],
67-
// 以下为可选配置
68-
// 'swooleSharedMemory' => [
69-
// unix socket 文件名,默认会自动放 runtime 目录中
70-
// 'socketFile' => '',
71-
72-
// 存储器类型,注意和上面的类名不同
73-
// 'storeTypes' => [
74-
// \Yurun\Swoole\SharedMemory\Store\KV::class,
75-
// \Yurun\Swoole\SharedMemory\Store\Stack::class,
76-
// \Yurun\Swoole\SharedMemory\Store\Queue::class,
77-
// \Yurun\Swoole\SharedMemory\Store\PriorityQueue::class,
78-
// 'name' => 'XXXClass',
79-
// ],
80-
81-
// 默认连接池名
82-
// 'defaultPool' => 'sharedMemory'
83-
// ],
84-
]
85-
```
86-
87-
在代码中操作:
88-
89-
```php
90-
// 方法一
91-
SharedMemory::use('KV', function(\Yurun\Swoole\SharedMemory\Client\Store\KV $kv){
92-
$kv->set('a', 1);
93-
});
94-
95-
// 方法二
96-
$kv = SharedMemory::getInstance()->getObject('KV');
97-
$kv->set('a', 1);
98-
```
99-
100-
## 免费技术支持
101-
102-
QQ群:17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png "点击加群")](https://jq.qq.com/?_wv=1027&k=5wXf4Zq),如有问题会有人解答和修复。
103-
104-
## 运行环境
105-
106-
- [PHP](https://php.net/) >= 7.1
107-
- [Composer](https://getcomposer.org/)
108-
- [Swoole](https://www.swoole.com/) >= 4.1.0
109-
110-
## 版权信息
111-
112-
`imi-shared-memory` 遵循 MIT 开源协议发布,并提供免费使用。
113-
114-
## 捐赠
115-
116-
<img src="https://raw.githubusercontent.com/imiphp/imi-shared-memory/dev/res/pay.png"/>
117-
118-
开源不求盈利,多少都是心意,生活不易,随缘随缘……
1+
# imi-shared-memory
2+
3+
[![Latest Version](https://img.shields.io/packagist/v/imiphp/imi-shared-memory.svg)](https://packagist.org/packages/imiphp/imi-shared-memory)
4+
[![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg)](https://secure.php.net/)
5+
[![Swoole Version](https://img.shields.io/badge/swoole-%3E=4.1.0-brightgreen.svg)](https://github.com/swoole/swoole-src)
6+
[![IMI License](https://img.shields.io/github/license/imiphp/imi-shared-memory.svg)](https://github.com/imiphp/imi-shared-memory/blob/master/LICENSE)
7+
8+
## 介绍
9+
10+
基于 [Swoole Shared Memory](https://github.com/Yurunsoft/swoole-shared-memory) 开发的 `imi` 框架跨进程变量共享组件。
11+
12+
> 本仓库仅用于浏览,不接受 issue 和 Pull Requests,请前往:<https://github.com/imiphp/imi>
13+
14+
## Composer
15+
16+
本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 `composer.json` 中加入下面的内容:
17+
18+
```json
19+
{
20+
"require": {
21+
"imiphp/imi-shared-memory": "~1.0"
22+
}
23+
}
24+
```
25+
26+
然后执行 `composer update` 安装。
27+
28+
## 使用
29+
30+
在项目 `config/config.php` 中配置:
31+
32+
```php
33+
[
34+
'components' => [
35+
// 引入本组件
36+
'SharedMemory' => 'Imi\SharedMemory',
37+
],
38+
'pools' => [
39+
// 客户端连接池
40+
'sharedMemory' => [
41+
'async' => [
42+
'pool' => [
43+
'class' => \Imi\SharedMemory\Pool\ClientPool::class,
44+
'config' => [
45+
'maxResources' => 100,
46+
'minResources' => 0,
47+
],
48+
],
49+
'resource' => [
50+
// 以下为可选配置
51+
52+
// 存储器类型,注意和下面的类名不同
53+
// 'storeTypes' => [
54+
// \Yurun\Swoole\SharedMemory\Client\Store\KV::class,
55+
// \Yurun\Swoole\SharedMemory\Client\Store\Stack::class,
56+
// \Yurun\Swoole\SharedMemory\Client\Store\Queue::class,
57+
// \Yurun\Swoole\SharedMemory\Client\Store\PriorityQueue::class,
58+
// 'name' => 'XXXClass',
59+
// ],
60+
61+
// unix socket 文件名,默认会自动放 runtime 目录中
62+
// 'socketFile' => '',
63+
],
64+
],
65+
]
66+
],
67+
// 以下为可选配置
68+
// 'swooleSharedMemory' => [
69+
// unix socket 文件名,默认会自动放 runtime 目录中
70+
// 'socketFile' => '',
71+
72+
// 存储器类型,注意和上面的类名不同
73+
// 'storeTypes' => [
74+
// \Yurun\Swoole\SharedMemory\Store\KV::class,
75+
// \Yurun\Swoole\SharedMemory\Store\Stack::class,
76+
// \Yurun\Swoole\SharedMemory\Store\Queue::class,
77+
// \Yurun\Swoole\SharedMemory\Store\PriorityQueue::class,
78+
// 'name' => 'XXXClass',
79+
// ],
80+
81+
// 默认连接池名
82+
// 'defaultPool' => 'sharedMemory'
83+
// ],
84+
]
85+
```
86+
87+
在代码中操作:
88+
89+
```php
90+
// 方法一
91+
SharedMemory::use('KV', function(\Yurun\Swoole\SharedMemory\Client\Store\KV $kv){
92+
$kv->set('a', 1);
93+
});
94+
95+
// 方法二
96+
$kv = SharedMemory::getInstance()->getObject('KV');
97+
$kv->set('a', 1);
98+
```
99+
100+
## 免费技术支持
101+
102+
QQ群:17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png "点击加群")](https://jq.qq.com/?_wv=1027&k=5wXf4Zq),如有问题会有人解答和修复。
103+
104+
## 运行环境
105+
106+
- [PHP](https://php.net/) >= 7.1
107+
- [Composer](https://getcomposer.org/)
108+
- [Swoole](https://www.swoole.com/) >= 4.1.0
109+
110+
## 版权信息
111+
112+
`imi-shared-memory` 遵循 MIT 开源协议发布,并提供免费使用。
113+
114+
## 捐赠
115+
116+
<img src="https://raw.githubusercontent.com/imiphp/imi-shared-memory/dev/res/pay.png"/>
117+
118+
开源不求盈利,多少都是心意,生活不易,随缘随缘……

composer.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
{
2-
"name": "imiphp/imi-shared-memory",
3-
"type": "library",
4-
"license": "MIT",
5-
"description": "imi 框架跨进程变量共享组件",
6-
"require": {
7-
"yurunsoft/swoole-shared-memory": "~1.0"
8-
},
9-
"require-dev": {},
10-
"autoload": {
11-
"psr-4": {
12-
"Imi\\SharedMemory\\": "src/"
13-
}
14-
}
1+
{
2+
"name": "imiphp/imi-shared-memory",
3+
"type": "library",
4+
"license": "MIT",
5+
"description": "imi 框架跨进程变量共享组件",
6+
"require": {
7+
"yurunsoft/swoole-shared-memory": "~1.0"
8+
},
9+
"require-dev": {},
10+
"autoload": {
11+
"psr-4": {
12+
"Imi\\SharedMemory\\": "src/"
13+
}
14+
}
1515
}

0 commit comments

Comments
 (0)