mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
add cache
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/Unknwon/goconfig"
|
||||
|
||||
"github.com/gogits/cache"
|
||||
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
@@ -37,6 +39,10 @@ var (
|
||||
|
||||
Cfg *goconfig.ConfigFile
|
||||
MailService *Mailer
|
||||
|
||||
Cache cache.Cache
|
||||
CacheAdapter string
|
||||
CacheConfig string
|
||||
)
|
||||
|
||||
var Service struct {
|
||||
@@ -182,6 +188,16 @@ func NewConfigContext() {
|
||||
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
|
||||
RunUser = Cfg.MustValue("", "RUN_USER")
|
||||
|
||||
CacheAdapter = Cfg.MustValue("cache", "ADAPTER")
|
||||
CacheConfig = Cfg.MustValue("cache", "CONFIG")
|
||||
|
||||
Cache, err = cache.NewCache(CacheAdapter, CacheConfig)
|
||||
if err != nil {
|
||||
fmt.Printf("Init cache system failed, adapter: %s, config: %s, %v\n",
|
||||
CacheAdapter, CacheConfig, err)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// Determine and create root git reposiroty path.
|
||||
RepoRootPath = Cfg.MustValue("repository", "ROOT")
|
||||
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
|
||||
|
Reference in New Issue
Block a user