Skip to content

Commit

Permalink
remove ttl check from functions where is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Duarte committed Jan 9, 2025
1 parent a8a3273 commit 152136b
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ func (cache *CacheDriver[T, K]) LazyRemove(keyVal T) error {
entry.lock.Lock()
defer entry.lock.Unlock()

if entry.expirationTime.Before(time.Now()) {
return ErrEntryExpired
}

if entry.state != COMPUTING && entry.state != AVAILABLE {
// In this way, when the entry is accessed again, it will be removed
entry.timestamp = time.Now()
Expand Down Expand Up @@ -158,9 +154,6 @@ func (cache *CacheDriver[T, K]) Touch(keyVal T) error {
defer entry.lock.Unlock()

currentTime := time.Now()
if entry.expirationTime.Before(currentTime) {
return ErrEntryExpired
}

if entry.state != COMPUTING && entry.state != AVAILABLE {
// In this way, when the entry is accessed again, it will be removed
Expand Down Expand Up @@ -803,9 +796,6 @@ func (cache *CacheDriver[T, K]) StoreOrUpdate(keyVal T, newValue K) error {
defer entry.lock.Unlock()

currentTime := time.Now()
if entry.expirationTime.Before(currentTime) {
return ErrEntryExpired
}

if entry.state != COMPUTING && entry.state != AVAILABLE {
if cache.toCompress {
Expand Down

0 comments on commit 152136b

Please sign in to comment.