Define global allowQuery / varies in nitro config

未关闭
#5,000 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
40/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

The feature touches the cache configuration in nitro.config.ts and the cachedHandler options, so start with how cache.defaults is read and merged with per-handler allowQuery and varies. The docs at https://nitro.build/docs/cache#global-options are the reference for current behaviour. Done means a global default can be set and a handler's cache key includes it, with the merge rule documented.

由索引模型根据 Issue 内容生成。

描述

cache config
Describe the feature

It would be nice if query params can be set in nitro.config.ts, so these query params always vary the cache key and reach every handler.

E.g. if every route takes a locale query param ?locale=fr, locale could be added globally so one does not have to add it to every cachedHandler (and possibly forgets it).

The same example when using Accept-Language header instead of query param: accept-language could be added to global varies, so one does not have to add it to every cachedHandler (and possibly forgets it).

Additional information

Apparently nitro config already allows for cache.defaults to be set but the docs don't say whether cachedHandlers allowQuery replaces or merges with the default: https://nitro.build/docs/cache#global-options

主要语言
TypeScript
星标
11.5k
派生
968
平均合并
4 天 9 小时
30 天内合并 PR
64

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nitrojs/nitro 的其他 Issue

查看 nitrojs/nitro 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。