Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么禁用缓存,服务器内存一直在涨,设置了maxAge和buffer也没用,想问一下怎么设置 #25

Open
RuiGZ opened this issue Jan 9, 2024 · 2 comments

Comments

@RuiGZ
Copy link

RuiGZ commented Jan 9, 2024

egg-static 配置:
config.static = {
maxAge: 0,
buffer: false,
maxFiles: 5,
};

node版本:20.10.0
egg版本:3.17.5
egg-static版本:2.3.1

在静态资源多次访问后,内存并没有被释放,尝试禁用缓存或者减少缓存的文件数量,但是不起作用,想问问大佬该怎么处理

@atian25
Copy link
Member

atian25 commented Jan 9, 2024

在 config.prod.js 里面去配置。

static 的设计是用来托管少量的静态资源的,所以在 prod 环境下会全部缓存,不要用来做文件服务,文件服务一般用 oss,或者自己写个路由。

@RuiGZ
Copy link
Author

RuiGZ commented Jan 9, 2024

在 config.prod.js 里面去配置。

static 的设计是用来托管少量的静态资源的,所以在 prod 环境下会全部缓存,不要用来做文件服务,文件服务一般用 oss,或者自己写个路由。

已经改成了在 config.prod.js 里面去配置了。即使设置了缓存项数量也是会全部缓存吗,如上我设置了maxFiles为5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants