aerospike / store
Aerospike支持的PHP 5.4自定义会话处理器
v0.1.0
2014-11-22 01:25 UTC
Requires
- php: >=5.4.0
- aerospike/aerospike-client-php: >=3.3
This package is not auto-updated.
Last update: 2024-09-10 03:11:15 UTC
README
使用Aerospike作为PHP的会话存储。Aerospike易于扩展,除了RAM之外,还支持SSD以在高度优化的架构中提供持久性。此会话处理器支持数据库级别的会话自动过期。了解更多关于Aerospike的信息。
依赖关系
- 它适用于PHP 5.4及以上版本。
- Aerospike PHP客户端:使用Composer,依赖项将自动安装。
安装
使用Composer
$ composer require aerospike/store "*"
手动
下载并使用AerospikeSessionHandler.php
。
使用方法
自动加载或
require 'AerospikeSessionHandler.php';
创建一个AerospikeSessionHandler
实例并将其设置为会话处理器
$Handler = new AerospikeSessionHandler(); session_set_save_handler($Handler); session_start();
可以传递一个自定义客户端实例
$db = new Aerospike(["hosts" => [["addr" => "127.0.0.1", "port" => 3000]]]); $Handler = new AerospikeSessionHandler($db);
还可以传递一组自定义选项
$Handler = new AerospikeSessionHandler(NULL, array( 'addr' => '127.0.0.1', 'port' => 3000, 'ns' => 'test', 'set' => 'session', 'bin' => 'data', 'ttl' => 3600 // defualt = session.gc_maxlifetime ));
单Bin
默认情况下,Aerospike命名空间支持每个键的多个bins
。由于会话存储仅使用单个bin来存储数据,因此建议在命名空间配置中启用single-bin
选项以提高性能。
贡献
- 分支它( https://github.com/amirrf/aerospike-store-php/fork )
- 创建您的功能分支(
git checkout -b my-new-feature
) - 提交您的更改(
git commit -am 'Add some feature'
) - 将更改推送到分支(
git push origin my-new-feature
) - 创建一个新的拉取请求
许可证
Aerospike-Store-PHP在Apache许可证第2版下提供,如LICENSE
文件中所述。