# micache **Repository Path**: tonysilver/micache ## Basic Information - **Project Name**: micache - **Description**: golang 迷你型文件缓存包 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 12 - **Forks**: 1 - **Created**: 2019-04-03 - **Last Updated**: 2025-02-13 ## Categories & Tags **Categories**: cache-modules **Tags**: None ## README # micache go mini file cache ## get micahce ````sh $ go get gitee.com/migopher/micache ```` #### Set Cache File Path ````sh package main import "gitee.com/migopher/micache" func main() { // set cache file path cache/ micache.Dir="cache/" } ```` #### Set Cache set cache and time ````sh package main import "gitee.com/migopher/micache" func main() { // set key expiration time 3600s or 0 is permanent save micache.Set("go", "golang", 3600) } ```` #### Get Cache get key cache value ````sh package main import ( "fmt" "gitee.com/migopher/micache" ) func main() { // get key cache value v := micache.Get("go") fmt.Println(v) } ```` #### Get Struct get key cache struct value ````sh package main import ( "fmt" "gitee.com/migopher/micache" ) type User struct { Uid int UserName string } func main() { getUser:=User{} micache.GetDecoding("go", &getUser) fmt.Println(getUser) } ```` #### Key Is Exist ````sh package main import ( "fmt" "gitee.com/migopher/micache" ) func main() { b:=micache.IsExist("go") fmt.Println(b) } ```` #### Delete Key delete cache key ````sh package main import ( "fmt" "gitee.com/migopher/micache" ) func main() { b:=micache.Delete("go") fmt.Println(b) } ````