@digabi/passport-saml-cache-postgres

中文文档
1.0.1发布于 2025/08/20EUPL-1.2TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 2038

A PostgreSQL-backed cache provider for @node-saml/passport-saml.

原始使用文档
文档目录3 节
  1. Usage
  2. Configuration
  3. Closing the cache

passport-saml-cache-postgres

A PostgreSQL-backed cache provider for @node-saml/passport-saml.

Usage

Create a passport_saml_cache table in your database. The default schema can be found in schema.sql.

import { Strategy as SamlStrategy } from '@node-saml/passport-saml'
import postgresCacheProvider from 'passport-saml-cache-postgres'

passport.use(new SamlStrategy({
    ... other passport-saml options,
    cacheProvider: postgresCacheProvider(pool) // A pg.Pool object
}))

Configuration

The postgresCacheProvider function accepts an optional second argument. The default options are as follows:

postgresCacheProvider(pool, {
  // The maximum age of a cache entry in milliseconds. Entries older than this are deleted automatically.
  // A scheduled job deletes old cache entries every `ttlMillis` milliseconds.
  ttlMillis: 1000 * 60 * 60, // 1 hour,
  // A logger to use. By default, messages are logged to console.
  // The logger should support at least `logger.info()` and `logger.error()` methods.
  logger: console
})

Closing the cache

The cache can be closed by calling the .close()-method. This stops the scheduled job that periodically clears stale cache entries.

版本与发布记录

@digabi/passport-saml-cache-postgres 共发布 2 个版本,首次发布于 2025/08/20;过去 12 个月发布了 0 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.1latest2025/08/201.2 年前
1.0.02025/08/201.2 年前

关于 @digabi/passport-saml-cache-postgres 的常见问题

@digabi/passport-saml-cache-postgres 是什么?

A PostgreSQL-backed cache provider for @node-saml/passport-saml.

如何安装 @digabi/passport-saml-cache-postgres?

在项目目录运行 npm install @digabi/passport-saml-cache-postgres,或使用 pnpm add / yarn add / bun add。

@digabi/passport-saml-cache-postgres 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@digabi/passport-saml-cache-postgres 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@digabi/passport-saml-cache-postgres 可以商用吗?

@digabi/passport-saml-cache-postgres 使用 EUPL-1.2 许可。声明的许可为 EUPL-1.2,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@digabi/passport-saml-cache-postgres 的下载量有多少?

根据 npm 官方下载统计,@digabi/passport-saml-cache-postgres 在 2026/10/12 – 2026/11/10 这 30 天内被下载 2,038 次,日均约 68 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@digabi/passport-saml-cache-postgres 还在维护吗?

最新版本 1.0.1 发布于 2025/08/20(1.2 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/08/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。