Remove cache expiration for link service
This commit is contained in:
parent
398d32f967
commit
e426559cec
1 changed files with 2 additions and 3 deletions
|
|
@ -3,7 +3,6 @@ package link
|
||||||
import (
|
import (
|
||||||
apperrors "cgnolink/errors"
|
apperrors "cgnolink/errors"
|
||||||
"github.com/patrickmn/go-cache"
|
"github.com/patrickmn/go-cache"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service interface {
|
type Service interface {
|
||||||
|
|
@ -22,7 +21,7 @@ type PgService struct {
|
||||||
func NewPgService(rep PgRepository) PgService {
|
func NewPgService(rep PgRepository) PgService {
|
||||||
return PgService{
|
return PgService{
|
||||||
rep: rep,
|
rep: rep,
|
||||||
cache: cache.New(1*time.Hour, 90*time.Minute),
|
cache: cache.New(cache.NoExpiration, 0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +58,7 @@ func (s *PgService) GetById(id string) (*Link, error) {
|
||||||
return nil, apperrors.NotFoundError{Message: "Link with given ID was not found."}
|
return nil, apperrors.NotFoundError{Message: "Link with given ID was not found."}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.cache.Set(id, link, 0)
|
s.cache.Set(id, link, cache.DefaultExpiration)
|
||||||
|
|
||||||
return link, nil
|
return link, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue