func (fc *FileCache) Incr(key string) error {
	data := fc.Get(key)
	var incr int
	if reflect.TypeOf(data).Name() != "int" {
		incr = 0
	} else {
		incr = data.(int) + 1
	}
	fc.Put(key, incr, FileCacheEmbedExpiry)
	return nil
}
Increase cached int value.
fc value is saving forever unless Delete.
package cache
import (
	"bytes"
	"crypto/md5"
	"encoding/gob"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"reflect"
	"strconv"
	"time"
)
func init() {
	Register("file", NewFileCache())
}
type FileCacheItem struct {
	Data       interface{}
	Lastaccess int64
	Expired    int64
}
var (
	FileCachePath           string = "cache"  
	FileCacheFileSuffix     string = ".bin"   
	FileCacheDirectoryLevel int    = 2        
	FileCacheEmbedExpiry    int64  = 0        
)
type FileCache struct {
	CachePath      string
	FileSuffix     string
	DirectoryLevel int
	EmbedExpiry    int
}
func NewFileCache() *FileCache {
	return &FileCache{}
}
func (fc *FileCache) StartAndGC(config string) error {
	var cfg map[string]string
	json.Unmarshal([]byte(config), &cfg)
	if _, ok := cfg["CachePath"]; !ok {
		cfg["CachePath"] = FileCachePath
	}
	if _, ok := cfg["FileSuffix"]; !ok {
		cfg["FileSuffix"] = FileCacheFileSuffix
	}
	if _, ok := cfg["DirectoryLevel"]; !ok {
		cfg["DirectoryLevel"] = strconv.Itoa(FileCacheDirectoryLevel)
	}
	if _, ok := cfg["EmbedExpiry"]; !ok {
		cfg["EmbedExpiry"] = strconv.FormatInt(FileCacheEmbedExpiry, 10)
	}
	fc.CachePath = cfg["CachePath"]
	fc.FileSuffix = cfg["FileSuffix"]
	fc.DirectoryLevel, _ = strconv.Atoi(cfg["DirectoryLevel"])
	fc.EmbedExpiry, _ = strconv.Atoi(cfg["EmbedExpiry"])
	fc.Init()
	return nil
}
func (fc *FileCache) Init() {
	app := filepath.Dir(os.Args[0])
	fc.CachePath = filepath.Join(app, fc.CachePath)
	if ok, _ := exists(fc.CachePath); !ok {  
		_ = os.MkdirAll(fc.CachePath, os.ModePerm)  
	}
}
func (fc *FileCache) getCacheFileName(key string) string {
	m := md5.New()
	io.WriteString(m, key)
	keyMd5 := hex.EncodeToString(m.Sum(nil))
	cachePath := fc.CachePath
	switch fc.DirectoryLevel {
	case 2:
		cachePath = filepath.Join(cachePath, keyMd5[0:2], keyMd5[2:4])
	case 1:
		cachePath = filepath.Join(cachePath, keyMd5[0:2])
	}
	if ok, _ := exists(cachePath); !ok {  
		_ = os.MkdirAll(cachePath, os.ModePerm)  
	}
	return filepath.Join(cachePath, fmt.Sprintf("%s%s", keyMd5, fc.FileSuffix))
}
func (fc *FileCache) Get(key string) interface{} {
	fileData, err := File_get_contents(fc.getCacheFileName(key))
	if err != nil {
		return ""
	}
	var to FileCacheItem
	Gob_decode(fileData, &to)
	if to.Expired < time.Now().Unix() {
		return ""
	}
	return to.Data
}
func (fc *FileCache) Put(key string, val interface{}, timeout int64) error {
	gob.Register(val)
	item := FileCacheItem{Data: val}
	if timeout == FileCacheEmbedExpiry {
		item.Expired = time.Now().Unix() + (86400 * 365 * 10)  
	} else {
		item.Expired = time.Now().Unix() + timeout
	}
	item.Lastaccess = time.Now().Unix()
	data, err := Gob_encode(item)
	if err != nil {
		return err
	}
	return File_put_contents(fc.getCacheFileName(key), data)
}
func (fc *FileCache) Delete(key string) error {
	filename := fc.getCacheFileName(key)
	if ok, _ := exists(filename); ok {
		return os.Remove(filename)
	}
	return nil
}