mirror of https://github.com/aldy505/cheapcash.git
22 lines
292 B
Go
22 lines
292 B
Go
|
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
|
||
|
}
|