For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt, and this page is available as Markdown at https://docs.halo.run/developer-guide/plugin/basics/server/data-storage.md.

数据存储

插件应根据数据用途、查询方式和生命周期选择存储方式,避免为少量配置自行维护数据库,也不要把不可恢复的业务数据当作缓存。

选择存储方式

数据类型建议方式
需要通过 Halo API 查询、授权或与其他插件交互的业务数据自定义模型和 ReactiveExtensionClient
由用户在插件设置页面维护的少量配置SettingConfigMapReactiveSettingFetcher
插件专用数据库、索引或无法表示为自定义模型的文件PluginsRootGetter 下的插件命名空间
可以重新生成的临时结果明确标识的缓存目录,并允许安全删除和重建

配置读取参考获取插件配置,自定义模型参考自定义模型