This commit is contained in:
liangzai
2025-07-31 15:41:00 +08:00
parent f3a3bc84c7
commit 934dce2776
36 changed files with 1614 additions and 264 deletions

View File

@@ -14,6 +14,12 @@ import (
// SetupGormCache 设置GORM缓存插件
func SetupGormCache(db *gorm.DB, cacheService interfaces.CacheService, cfg *config.Config, logger *zap.Logger) error {
// 缓存功能已完全禁用
logger.Info("GORM缓存插件已禁用 - 所有查询将直接访问数据库")
return nil
// 以下是原有的缓存配置代码,已注释掉
/*
// 创建缓存配置
cacheConfig := cache.CacheConfig{
DefaultTTL: 30 * time.Minute,
@@ -29,16 +35,16 @@ func SetupGormCache(db *gorm.DB, cacheService interfaces.CacheService, cfg *conf
// 配置启用缓存的表
EnabledTables: []string{
"product",
"product_category",
"enterprise_info_submit_records",
"sms_codes",
"wallets",
"subscription",
"product_category",
"product_documentation",
"enterprise_infos",
"api_users",
// "product",
// "product_category",
// "enterprise_info_submit_records",
// "sms_codes",
// "wallets",
// "subscription",
// "product_category",
// "product_documentation",
// "enterprise_infos",
// "api_users",
// 添加更多需要缓存的表
},
@@ -68,8 +74,9 @@ func SetupGormCache(db *gorm.DB, cacheService interfaces.CacheService, cfg *conf
zap.Strings("enabled_tables", cacheConfig.EnabledTables),
zap.Strings("disabled_tables", cacheConfig.DisabledTables),
)
*/
return nil
// return nil
}
// GetCacheConfig 根据环境获取缓存配置
@@ -89,10 +96,10 @@ func GetCacheConfig(cfg *config.Config) cache.CacheConfig {
InvalidateDelay: 50 * time.Millisecond,
EnabledTables: []string{
"product",
"product_category",
"enterprise_info_submit_records",
"sms_codes",
// "product",
// "product_category",
// "enterprise_info_submit_records",
// "sms_codes",
},
DisabledTables: []string{
@@ -120,10 +127,10 @@ func GetCacheConfig(cfg *config.Config) cache.CacheConfig {
InvalidateDelay: 200 * time.Millisecond,
EnabledTables: []string{
"product",
"product_category",
"enterprise_info_submit_records",
"sms_codes",
// "product",
// "product_category",
// "enterprise_info_submit_records",
// "sms_codes",
},
DisabledTables: []string{