Don't cache physical responses when thre was an error (#2040)
This commit is contained in:
parent
49f6ab681e
commit
9d5462ca04
|
@ -45,7 +45,9 @@ func (c *Cache) Purge() {
|
|||
|
||||
func (c *Cache) Put(entry *Entry) error {
|
||||
err := c.backend.Put(entry)
|
||||
if err == nil {
|
||||
c.lru.Add(entry.Key, entry)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -78,7 +80,9 @@ func (c *Cache) Get(key string) (*Entry, error) {
|
|||
|
||||
func (c *Cache) Delete(key string) error {
|
||||
err := c.backend.Delete(key)
|
||||
if err == nil {
|
||||
c.lru.Remove(key)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue