コード例 #1
0
ファイル: storage.go プロジェクト: crit/critical-go
// Folder returns an instance of Storage backed by the local
// file system. Each key is a file at the provided path.
func Folder(path string) Storage {
	if path == "" {
		return local.New()
	}

	return folder.New(path)
}
コード例 #2
0
ファイル: storage.go プロジェクト: crit/critical-go
// Redis returns an instance of Storage backed by a Redis service.
func Redis(host, port string) Storage {
	if host == "" || port == "" {
		return local.New()
	}

	return redis.New(host, port)
}
コード例 #3
0
ファイル: storage.go プロジェクト: crit/critical-go
// Local returns an instance of Storage backed only by the
// memory of the running binary.
func Local() Storage {
	return local.New()
}