Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

How do I limit the size of the cache?

未关闭
#125 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, nginx

调研方向

从所引用的 examples/nginx.conf 和缓存插件文档开始,目前文档描述的是基于过期时间的缓存。调查缓存实现是否提供响应总大小限制或 LRU 淘汰,并确定相关的配置和测试。完成的标准是:记录受支持的行为,或明确规定缺失的基于大小的 LRU 策略。

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

描述

I'm trying to translate this nginx config to Caddy:
https://github.com/grishka/Smithereen/blob/4dcad9dd968b2ae6be04281d6a9ca72d13d4cfc8/examples/nginx.conf

This works but doesn't do so optimally because it would hit imgproxy every time a client requests a resized image:

smithereen.local

encode

# Static files
handle /s/* {
	root /var/www/smithereen
	file_server
}

# imgproxy
handle /i/* {
	reverse_proxy 127.0.0.1:4560
}

# Server application itself
handle {
	reverse_proxy 127.0.0.1:4567
}

So I started looking into replicating my nginx setup, where I cache the images processed by imgproxy, and this plugin seems to be the way to do cache on Caddy. Except I couldn't find a way to limit the cache by the combined size of all cached responses instead of the time, so least-recently used responses would get deleted to make room for new ones. Ideally I would just not have any expiration component whatsoever to my caching strategy, but nginx can't do that so I set the TTL to 10 years.

Does this plugin not support this sort of LRU strategy, or did I overlook it? The docs all only talk about the expiration time.

主要语言
Go
星标
393
派生
30
平均合并
32 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

caddyserver/cache-handler 的其他 Issue

查看 caddyserver/cache-handler 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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