Skip to content

Commit

Permalink
fix: fix cache config CacheMaxItemCnt error
Browse files Browse the repository at this point in the history
  • Loading branch information
asjdf committed Jun 14, 2023
1 parent e4515fd commit c704ff7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (h *queryHandler) AfterQuery() func(db *gorm.DB) {

if cache.Config.CacheLevel == config.CacheLevelAll || cache.Config.CacheLevel == config.CacheLevelOnlySearch {
// cache search data
if int64(len(objects)) > cache.Config.CacheMaxItemCnt {
if cache.Config.CacheMaxItemCnt != 0 && int64(len(objects)) > cache.Config.CacheMaxItemCnt {
return
}

Expand Down Expand Up @@ -273,7 +273,7 @@ func (h *queryHandler) AfterQuery() func(db *gorm.DB) {
if len(primaryKeys) != len(objects) {
return
}
if int64(len(objects)) > cache.Config.CacheMaxItemCnt {
if cache.Config.CacheMaxItemCnt != 0 && int64(len(objects)) > cache.Config.CacheMaxItemCnt {
cache.Logger.CtxInfo(ctx, "[AfterQuery] objects length is more than max item count, not cached")
return
}
Expand Down

0 comments on commit c704ff7

Please sign in to comment.