cheapcash/delete.go

22 lines
292 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 {
check, err := c.Exists(c.Path + "/" + key)
if err != nil {
return err
}
if !check {
return ErrNotExists
}
err = os.Remove(sanitizePath(c.Path + "/" + key))
if err != nil {
return err
}
return nil
}