Cache add memory driver (#30)

This commit is contained in:
Wenbo Han
2023-02-08 21:51:58 +08:00
committed by GitHub
parent b3ec52e843
commit 486b8727a4
10 changed files with 35 additions and 32 deletions

View File

@@ -26,7 +26,7 @@ func Boot() {}
func init() {
config := facades.Config
config.Add("app", map[string]interface{}{
config.Add("app", map[string]any{
// Application Name
//
// This value is the name of your application. This value is used when the

View File

@@ -6,13 +6,13 @@ import (
func init() {
config := facades.Config
config.Add("auth", map[string]interface{}{
config.Add("auth", map[string]any{
// Authentication Defaults
//
// This option controls the default authentication "guard"
// reset options for your application. You may change these defaults
// as required, but they're a perfect start for most applications.
"defaults": map[string]interface{}{
"defaults": map[string]any{
"guard": "user",
},
@@ -27,8 +27,8 @@ func init() {
// mechanisms used by this application to persist your user's data.
//
// Supported: "jwt"
"guards": map[string]interface{}{
"user": map[string]interface{}{
"guards": map[string]any{
"user": map[string]any{
"driver": "jwt",
},
},

View File

@@ -6,22 +6,25 @@ import (
func init() {
config := facades.Config
config.Add("cache", map[string]interface{}{
config.Add("cache", map[string]any{
// Default Cache Store
//
// This option controls the default cache connection that gets used while
// using this caching library. This connection is used when another is
// not explicitly specified when executing a given caching function.
"default": config.Env("CACHE_STORE", "redis"),
"default": config.Env("CACHE_STORE", "memory"),
// Cache Stores
//
// Here you may define all the cache "stores" for your application as
// well as their drivers. You may even define multiple stores for the
// same cache driver to group types of items stored in your caches.
// Available Drivers: "redis", "custom"
"stores": map[string]interface{}{
"redis": map[string]interface{}{
// Available Drivers: "memory", "redis", "custom"
"stores": map[string]any{
"memory": map[string]any{
"driver": "memory",
},
"redis": map[string]any{
"driver": "redis",
"connection": "default",
},

View File

@@ -6,7 +6,7 @@ import (
func init() {
config := facades.Config
config.Add("cors", map[string]interface{}{
config.Add("cors", map[string]any{
// Cross-Origin Resource Sharing (CORS) Configuration
//
// Here you may configure your settings for cross-origin resource sharing

View File

@@ -6,13 +6,13 @@ import (
func init() {
config := facades.Config
config.Add("database", map[string]interface{}{
config.Add("database", map[string]any{
// Default database connection name, only support Mysql now.
"default": config.Env("DB_CONNECTION", "mysql"),
// Database connections
"connections": map[string]interface{}{
"mysql": map[string]interface{}{
"connections": map[string]any{
"mysql": map[string]any{
"driver": "mysql",
"host": config.Env("DB_HOST", "127.0.0.1"),
"port": config.Env("DB_PORT", "3306"),
@@ -22,7 +22,7 @@ func init() {
"charset": "utf8mb4",
"loc": "Local",
},
"postgresql": map[string]interface{}{
"postgresql": map[string]any{
"driver": "postgresql",
"host": config.Env("DB_HOST", "127.0.0.1"),
"port": config.Env("DB_PORT", "3306"),
@@ -32,11 +32,11 @@ func init() {
"sslmode": "disable",
"timezone": "UTC", //Asia/Shanghai
},
"sqlite": map[string]interface{}{
"sqlite": map[string]any{
"driver": "sqlite",
"database": config.Env("DB_DATABASE", "forge"),
},
"sqlserver": map[string]interface{}{
"sqlserver": map[string]any{
"driver": "sqlserver",
"host": config.Env("DB_HOST", "127.0.0.1"),
"port": config.Env("DB_PORT", "3306"),
@@ -59,8 +59,8 @@ func init() {
// Redis is an open source, fast, and advanced key-value store that also
// provides a richer body of commands than a typical key-value system
// such as APC or Memcached.
"redis": map[string]interface{}{
"default": map[string]interface{}{
"redis": map[string]any{
"default": map[string]any{
"host": config.Env("REDIS_HOST", ""),
"password": config.Env("REDIS_PASSWORD", ""),
"port": config.Env("REDIS_PORT", 6379),

View File

@@ -6,7 +6,7 @@ import (
func init() {
config := facades.Config
config.Add("grpc", map[string]interface{}{
config.Add("grpc", map[string]any{
// Grpc Configuration
//
// Configure your server host

View File

@@ -6,7 +6,7 @@ import (
func init() {
config := facades.Config
config.Add("jwt", map[string]interface{}{
config.Add("jwt", map[string]any{
// JWT Authentication Secret
//
// Don't forget to set this in your .env file, as it will be used to sign

View File

@@ -6,7 +6,7 @@ import (
func init() {
config := facades.Config
config.Add("logging", map[string]interface{}{
config.Add("logging", map[string]any{
// Default Log Channel
//
// This option defines the default log channel that gets used when writing
@@ -19,17 +19,17 @@ func init() {
// Here you may configure the log channels for your application.
// Available Drivers: "single", "daily", "custom", "stack"
// Available Level: "debug", "info", "warning", "error", "fatal", "panic"
"channels": map[string]interface{}{
"stack": map[string]interface{}{
"channels": map[string]any{
"stack": map[string]any{
"driver": "stack",
"channels": []string{"daily"},
},
"single": map[string]interface{}{
"single": map[string]any{
"driver": "single",
"path": "storage/logs/goravel.log",
"level": config.Env("LOG_LEVEL", "debug"),
},
"daily": map[string]interface{}{
"daily": map[string]any{
"driver": "daily",
"path": "storage/logs/goravel.log",
"level": config.Env("LOG_LEVEL", "debug"),

View File

@@ -4,7 +4,7 @@ import "github.com/goravel/framework/facades"
func init() {
config := facades.Config
facades.Config.Add("mail", map[string]interface{}{
facades.Config.Add("mail", map[string]any{
// SMTP Host Address
//
// Here you may provide the host address of the SMTP server used by your
@@ -26,7 +26,7 @@ func init() {
// You may wish for all e-mails sent by your application to be sent from
// the same address. Here, you may specify a name and address that is
// used globally for all e-mails that are sent by your application.
"from": map[string]interface{}{
"from": map[string]any{
"address": config.Env("MAIL_FROM_ADDRESS", "hello@example.com"),
"name": config.Env("MAIL_FROM_NAME", "Example"),
},

View File

@@ -6,7 +6,7 @@ import (
func init() {
config := facades.Config
config.Add("queue", map[string]interface{}{
config.Add("queue", map[string]any{
// Default Queue Connection Name
"default": config.Env("QUEUE_CONNECTION", "sync"),
@@ -14,11 +14,11 @@ func init() {
//
// Here you may configure the connection information for each server that is used by your application.
// Drivers: "sync", "redis"
"connections": map[string]interface{}{
"sync": map[string]interface{}{
"connections": map[string]any{
"sync": map[string]any{
"driver": "sync",
},
"redis": map[string]interface{}{
"redis": map[string]any{
"driver": "redis",
"connection": "default",
"queue": config.Env("REDIS_QUEUE", "default"),