alfatraining/cassandra-session-handler-bundle
Composer 安装命令:
composer require alfatraining/cassandra-session-handler-bundle
包简介
Cassandra Session Handler Bundle for Symfony 4 & 5.4
README 文档
README
This Symfony 4 / 5.4 bundle provides a session handler for saving sessions in Cassandra.
Installation
- Add the repository and requirement to
composer.json:
{ "repositories": [ { "type": "vcs", "url": "git@github.com:alfatraining/cassandra-session-handler-bundle.git" } ], "require": { "alfatraining/cassandra-session-handler-bundle": "dev-master" } }
-
Install the bundle via
composer updateorcomposer update nothingif you don't want updates. -
Register the bundle in
app/AppKernel.php:
new Alfatraining\CassandraSessionHandlerBundle\AlfatrainingCassandraSessionHandlerBundle(),
- Add configuration parameters to your
app/config/config.yml(the following shows the bundle defaults) and activate the session handler:
framework: session: handler_id: alfatraining_cassandra_session_handler.cassandra_session_handler alfatraining_cassandra_session_handler: keyspace: symfony2_sessions # Cassandra keyspace to use column_family: sessions # Cassandra table/column family to use session_lifetime: 84600 # session lifetime in seconds
- Add parameters to
app/config/parameters.yml.distto configure the Cassandra cluster instance:
parameters: # contact points can be 1) a single node (not advisable for Cassandra) cassandra_cluster.contact_points: localhost # or 2) a comma-separated list of nodes (mixed host names / IP addresses possible) cassandra_cluster.contact_points: localhost, 127.0.0.1, 172.18.1.10 # or 3) a native YAML array cassandra_cluster.contact_points: - localhost - 127.0.0.1 # of course, you may also write this using the inline style cassandra_cluster.contact_points: [localhost, 127.0.0.1] # optionally set the credentials to be used for connecting to the Cassandra cluster cassandra_cluster.credentials.username: cassandra cassandra_cluster.credentials.password: cassandra
In Symfony 4, you can use an environnement variable which contains comma-separated values as a string :
# services.yaml parameters: cassandra_cluster.contact_points: '%env(string:CASSANDRA_CLUSTER_HOSTS)%'
# .env.local
CASSANDRA_CLUSTER_HOSTS=10.0.0.1,10.0.0.2,10.0.0.3
Then run composer install again or update your parameters.yml by hand.
- Don't forget to actually create the keyspace and the column family. An example of the CQL that's needed can be found in
Resources/doc/create_session_keyspace_and_table.sqlinside this bundle.
As you can see in the Resources/config/services.yml file you need to pass a Cassandra\Cluster (it's an interface even if it doesn't like one) instance to the session handler upon instantiation. Because the DefaultCluster has a lot of configuration options (for SSL, authentication and a whole lot more – see http://datastax.github.io/php-driver/api/Cassandra/Cluster/class.Builder/ for more information) you may replace this class entirely and just instantiate your own custom cluster class instance. Here's how:
- Replace the class name to use in your
app/config/config.ymlfile:
parameters: cassandra_cluster.class: Namespace/To/Your/Own/Class
- Take a look at how the bundle's implementation works in
Lib/Cassandra/Cluster.php.
alfatraining/cassandra-session-handler-bundle 适用场景与选型建议
alfatraining/cassandra-session-handler-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.57k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 08 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「bundle」 「session」 「cassandra」 「datastax」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alfatraining/cassandra-session-handler-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alfatraining/cassandra-session-handler-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alfatraining/cassandra-session-handler-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Secure session middleware for Slim 3 framework
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
Non-I/O blocking PHP SessionHandler implementation using Nette/Caching with DI Extension for Nette framework
DMS Meetup API Bundle, enables Meetup API clients in services
统计信息
- 总下载量: 37.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-16