承接 xp-forge/mongo-sessions 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xp-forge/mongo-sessions

最新稳定版本:v4.0.0

Composer 安装命令:

composer require xp-forge/mongo-sessions

包简介

MongoDB Sessions

关键字:

README 文档

README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.4+ Supports PHP 8.0+ Latest Stable Version

MongoDB-based sessions implementation.

Example

use web\session\InMongoDB;
use com\mongodb\MongoConnection;

$conn= new MongoConnection('mongodb://localhost');
$sessions= new InMongoDB($conn->collection('test', 'sessions'));

Session expiry

By default, cleaning up expired sessions is handled by the implementation. For a more performant version, use TTL indexes as follows.

Setup collection

Issue the following in MongoDB shell:

db.sessions.createIndex({"_created": 1}, {expireAfterSeconds: 86400})

Add TTL flag

Pass InMongoDB::USING_TTL as second parameter to the InMongoDB constructor:

$sessions= new InMongoDB($conn->collection('test', 'sessions'), InMongoDB::USING_TTL);

This will use the expireAfterSeconds value as session duration.

统计信息

  • 总下载量: 1.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-04-12