github.com/goravel/framework@v1.13.9/cache/service_provider.go (about) 1 package cache 2 3 import ( 4 "github.com/goravel/framework/cache/console" 5 contractsconsole "github.com/goravel/framework/contracts/console" 6 "github.com/goravel/framework/contracts/foundation" 7 ) 8 9 const Binding = "goravel.cache" 10 11 type ServiceProvider struct { 12 } 13 14 func (database *ServiceProvider) Register(app foundation.Application) { 15 app.Singleton(Binding, func(app foundation.Application) (any, error) { 16 config := app.MakeConfig() 17 log := app.MakeLog() 18 store := config.GetString("cache.default") 19 20 return NewApplication(config, log, store) 21 }) 22 } 23 24 func (database *ServiceProvider) Boot(app foundation.Application) { 25 database.registerCommands(app) 26 } 27 28 func (database *ServiceProvider) registerCommands(app foundation.Application) { 29 app.MakeArtisan().Register([]contractsconsole.Command{ 30 console.NewClearCommand(app.MakeCache()), 31 }) 32 }