Skip to content

Commit

Permalink
constant for cache ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Jun 11, 2024
1 parent 05dc7d3 commit 9dea5b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions backend/constants/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ const (
MAX_IDLE_CONNECTIONS int = 10
MAX_OPEN_CONNECTIONS int = 100
DB_TIMEOUT time.Duration = 200 * time.Millisecond
DB_CACHE_TTL time.Duration = 60 * time.Second
)
3 changes: 1 addition & 2 deletions backend/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package database

import (
"errors"
"time"

"github.com/GenerateNU/sac/backend/config"
"github.com/GenerateNU/sac/backend/constants"
Expand All @@ -20,7 +19,7 @@ func ConfigureDB(settings config.Settings) (*gorm.DB, error) {
}

cache := cache.NewGormCache("db_cache", cache.NewRedisClient(settings.DBCache), cache.CacheConfig{
TTL: 60 * time.Second,
TTL: constants.DB_CACHE_TTL,
Prefix: "cache:",
})

Expand Down

0 comments on commit 9dea5b6

Please sign in to comment.