openreplay/backend/pkg/db/cache/pg-cache.go
Rajesh Rajendran 2b28a36736
Fixed issue with wrong expiration timeout for projects (#1300) (#1339)
* fix(backend): fixed issue with wrong expiration timeout for projects in cache layer

* fix(backend): removed direct call db.GetProject()

* feat(backend): set default PROJECT_EXPIRATION to 10 minutes

Co-authored-by: Alexander <zavorotynskiy@pm.me>
2023-06-13 15:15:40 +02:00

21 lines
407 B
Go

package cache
import (
"openreplay/backend/pkg/db/postgres"
"time"
)
type PGCache struct {
*postgres.Conn
Cache Cache
}
func NewPGCache(conn *postgres.Conn, projectExpiration time.Duration) *PGCache {
// Create in-memory cache layer for sessions and projects
c := NewCache(conn, projectExpiration)
// Return PG wrapper with integrated cache layer
return &PGCache{
Conn: conn,
Cache: c,
}
}