---
title: "更新缓存配置"
method: PUT
path: "/cache-manage/config"
tags: ["缓存管理"]
---

# 更新缓存配置

`PUT /cache-manage/config`

更新服务端音乐缓存的配置,如最大缓存大小和缓存目录。cache_dir 为空字符串时恢复使用默认目录。更新后会自动触发 LRU 淘汰检查。切换目录时不会自动迁移旧缓存文件。

## Request body

- ServicesCacheConfig
  - `cache_dir` string — 自定义缓存目录，空字符串表示使用默认目录
  - `max_size` integer — 最大缓存大小（字节），0 表示无限制

## Response `200`

更新后的缓存配置

- ServicesCacheConfigResponse
  - `cache_dir` string
  - `default_cache_dir` string
  - `max_size` integer

## Other responses

- `400` — 请求参数无效
- `500` — 更新失败

---

[API](https://skmtc.dev/songloft-org/apis/songloft-api.md) · [All operations](https://skmtc.dev/songloft-org/apis/songloft-api/llms.txt) · [OpenAPI document](https://skmtc.dev/songloft-org/apis/songloft-api/revisions/7cbe0940a38b?raw)
