Categorygithub.com/liyaojian/cache
repositorypackage
0.0.0-20220121124504-b978a1a38253
Repository: https://github.com/liyaojian/cache.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

File Cache

Usage:

package main

import (
	"fmt"
	"github.com/liyaojian/cache"
	"time"
)

func main() {
	c := cache.NewFileCache("./cache")
	key := "name"

	// set
	c.Set(key, "cache value", time.Minute)
	fmt.Println(c.Has(key), c.Count())

	// get
	val := c.Get(key)
	fmt.Println(val)

	// del
	c.Del(key)
	fmt.Println(c.Has(key), c.Count())
}