func (d *DiskStorer) ResetExpiry(key string) error {
	if !validKey(key) {
		return errNoSession{}
	}
	filePath := path.Join(d.folderPath, key)
	nowTime := time.Now().UTC()
	return os.Chtimes(filePath, nowTime, nowTime)
}
ResetExpiry resets the expiry of the key
package abcsessions
import (
	"io/ioutil"
	"os"
	"path"
	"sync"
	"time"
	"github.com/djherbis/times"
	"github.com/friendsofgo/errors"
)
type DiskStorer struct {
	folderPath string
	maxAge time.Duration
	cleanInterval time.Duration
	mut sync.RWMutex
	wg sync.WaitGroup
	quit chan struct{}
}
func NewDefaultDiskStorer(tmpSubFolder string) (*DiskStorer, error) {
	folderPath := path.Join(os.TempDir(), tmpSubFolder)
	return NewDiskStorer(folderPath, time.Hour*24*2, time.Hour)
}
func NewDiskStorer(folderPath string, maxAge, cleanInterval time.Duration) (*DiskStorer, error) {
	if (maxAge != 0 && cleanInterval == 0) || (cleanInterval != 0 && maxAge == 0) {
		panic("if max age or clean interval is set, the other must also be set")
	}
	d := &DiskStorer{
		folderPath:    folderPath,
		maxAge:        maxAge,
		cleanInterval: cleanInterval,
	}
	_, err := os.Stat(folderPath)
	if os.IsNotExist(err) {
		err := os.Mkdir(folderPath, os.FileMode(int(0755)))
		if err != nil {
			return nil, errors.Wrapf(err, "unable to make directory: %s", folderPath)
		}
	}
	return d, nil
}
func (d *DiskStorer) All() ([]string, error) {
	files, err := ioutil.ReadDir(d.folderPath)
	if err != nil {
		return []string{}, errors.Wrapf(err, "unable to read directory: %s", d.folderPath)
	}
	sessions := make([]string, len(files))
	for i := 0; i < len(files); i++ {
		sessions[i] = files[i].Name()
	}
	return sessions, nil
}
func (d *DiskStorer) Get(key string) (value string, err error) {
	if !validKey(key) {
		return "", errNoSession{}
	}
	filePath := path.Join(d.folderPath, key)
	d.mut.RLock()
	defer d.mut.RUnlock()
	_, err = os.Stat(filePath)
	if err != nil {
		return "", errors.Wrapf(err, "unable to stat session file: %s", filePath)
	}
	contents, err := ioutil.ReadFile(filePath)
	if err != nil {
		return "", errors.Wrapf(err, "unable to read file: %s", filePath)
	}
	return string(contents), nil
}
func (d *DiskStorer) Set(key, value string) error {
	if !validKey(key) {
		return errNoSession{}
	}
	filePath := path.Join(d.folderPath, key)
	d.mut.Lock()
	defer d.mut.Unlock()
	return ioutil.WriteFile(filePath, []byte(value), 0600)
}
func (d *DiskStorer) Del(key string) error {
	if !validKey(key) {
		return errNoSession{}
	}
	filePath := path.Join(d.folderPath, key)
	d.mut.Lock()
	defer d.mut.Unlock()
	_, err := os.Stat(filePath)
	if os.IsNotExist(err) {
		return nil
	} else if err != nil {
		return errors.Wrapf(err, "unable to stat session file: %s", filePath)
	}
	return os.Remove(filePath)
}
func (d *DiskStorer) StopCleaner() {
	close(d.quit)
	d.wg.Wait()
}