FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cache-handler/app.go at master · jtelo88/cache-handler · GitHub
jtelo88
cache-handler
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cache-handler
/
app.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (54 loc) · 1.64 KB
Breadcrumbs
cache-handler
/
app.go
Copy path
File metadata and controls
63 lines (54 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package
httpcache
import
(
"github.com/caddyserver/caddy/v2"
"github.com/darkweak/souin/configurationtypes"
"github.com/darkweak/souin/pkg/storage/types"
"github.com/darkweak/souin/pkg/surrogate/providers"
"github.com/darkweak/storages/core"
)
// SouinApp contains the whole Souin necessary items
type
SouinApp
struct
{
DefaultCache
// The provider to use.
Storers
[]types.
Storer
// Surrogate storage to support the configuration reload without surrogate-key data loss.
SurrogateStorage
providers.
SurrogateInterface
// SurrogateKeyDisabled opt-out the Surrogate key system.
SurrogateKeyDisabled
bool
// Cache-key tweaking.
CacheKeys
configurationtypes.
CacheKeys
`json:"cache_keys,omitempty"`
// API endpoints enablers.
API
configurationtypes.
API
`json:"api,omitempty"`
// Logger level, fallback on caddy's one when not redefined.
LogLevel
string
`json:"log_level,omitempty"`
}
func
init
() {
caddy
.
RegisterModule
(
SouinApp
{})
}
// Provision implements caddy.Provisioner
func
(
s
SouinApp
)
Provision
(
_
caddy.
Context
)
error
{
return
nil
}
// Start will start the App
func
(
s
SouinApp
)
Start
()
error
{
core
.
ResetRegisteredStorages
()
_
,
_
=
up
.
Delete
(
stored_providers_key
)
_
,
_
=
up
.
LoadOrStore
(
stored_providers_key
,
newStorageProvider
())
return
nil
}
// Stop will stop the App
func
(
s
SouinApp
)
Stop
()
error
{
return
nil
}
// CaddyModule implements caddy.ModuleInfo
func
(
s
SouinApp
)
CaddyModule
() caddy.
ModuleInfo
{
return
caddy.
ModuleInfo
{
ID
:
moduleName
,
New
:
func
() caddy.
Module
{
return
new
(
SouinApp
) },
}
}
var
(
_
caddy.
App
=
(
*
SouinApp
)(
nil
)
_
caddy.
Module
=
(
*
SouinApp
)(
nil
)
_
caddy.
Provisioner
=
(
*
SouinApp
)(
nil
)
)
Back
|
FazBrowse Home
|
New Git URL