Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 56ad5d2

Browse filesBrowse files
committed
Merge pull request revel#603 from klauspost/develop
Redis Cache: Save a roundtrip on delete
2 parents 8ede540 + 5d2e774 commit 56ad5d2
Copy full SHA for 56ad5d2

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎cache/redis.go

Copy file name to clipboardExpand all lines: cache/redis.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ func exists(conn redis.Conn, key string) bool {
126126
func (c RedisCache) Delete(key string) error {
127127
conn := c.pool.Get()
128128
defer conn.Close()
129-
if !exists(conn, key) {
129+
existed, err := redis.Bool(conn.Do("DEL", key))
130+
if !existed {
130131
return ErrCacheMiss
131132
}
132-
_, err := conn.Do("DEL", key)
133133
return err
134134
}
135135

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.