Don't cache physical responses when thre was an error (#2040)

This commit is contained in:
Jeff Mitchell 2016-10-28 12:55:56 -04:00 committed by GitHub
parent 49f6ab681e
commit 9d5462ca04
1 changed files with 6 additions and 2 deletions

View File

@ -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
}