cheapcash/delete.go

22 lines
291 B
Go
Raw Normal View History

2021-11-16 04:56:33 +00:00
package cheapcash
import "os"
func (c *Cache) Delete(key string) error {
2021-11-16 05:01:41 +00:00
check, err := c.Exists(c.Path + "/" + key)
2021-11-16 04:56:33 +00:00
if err != nil {
return err
}
if !check {
return ErrNotExists
}
err = os.Remove(sanitizePath(c.Path + "/" + key))
if err != nil {
return err
}
return nil
}