This commit is contained in:
2026-01-29 15:03:38 +08:00
parent 2363a51a6a
commit 2fea046981
5 changed files with 42 additions and 53 deletions

View File

@@ -98,6 +98,13 @@ func (m *PDFCacheManager) GetByProduct(productID, version string) ([]byte, bool,
return pdfBytes, hit, err
}
// GetByCacheKey 通过缓存键直接获取PDF文件
// 适用于已经持久化了缓存键例如作为报告ID的场景
// 返回PDF字节流、是否命中缓存、文件创建时间、错误
func (m *PDFCacheManager) GetByCacheKey(cacheKey string) ([]byte, bool, time.Time, error) {
return m.getByKey(cacheKey, "", "")
}
// getByKey 内部方法:根据缓存键获取文件
func (m *PDFCacheManager) getByKey(cacheKey string, key1, key2 string) ([]byte, bool, time.Time, error) {
cachePath := m.GetCachePath(cacheKey)