This repository has been archived by the owner on Dec 4, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wenzl
committed
Jan 12, 2018
1 parent
8e39db0
commit c57bd4a
Showing
5 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package cache | ||
|
||
import ( | ||
"time" | ||
|
||
cache "github.com/patrickmn/go-cache" | ||
) | ||
|
||
func init() { | ||
//初始化cache | ||
GetCache() | ||
} | ||
|
||
var c *cache.Cache | ||
|
||
//GetCache 获取cache对象 | ||
func GetCache() *cache.Cache { | ||
if c != nil { | ||
return c | ||
} | ||
c = cache.New(5*time.Minute, 10*time.Minute) | ||
return c | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters