mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 22:26:38 +08:00
refactor: eliminate string/magic-number literals (goconst, mnd) and fix const-type grouping (SA9004)
- upload/task: taskCategoryUpload/taskQueueDefault 常量替代 8 处字面量 - admin: 复用既有 logDBNameSQLite 常量替代 3 处 "sqlite" 字面量 - pkg/cache/disk: defaultCleanupInterval 命名常量 - driver_asynq_worker/executor: 分离 contextKey 类型常量组 lint_issues 45→34, tests 44/44
This commit is contained in:
Vendored
+4
-1
@@ -91,13 +91,16 @@ func New(basePath string) *Cache {
|
||||
var (
|
||||
defaultCache *Cache
|
||||
defaultCacheOnce sync.Once
|
||||
|
||||
// defaultCleanupInterval 全局磁盘缓存默认的过期清理巡检周期
|
||||
defaultCleanupInterval = 10 * time.Minute
|
||||
)
|
||||
|
||||
// Default returns the default global disk cache instance.
|
||||
func Default() *Cache {
|
||||
defaultCacheOnce.Do(func() {
|
||||
defaultCache = New("uploads/diskcache")
|
||||
go defaultCache.StartCleanupWorker(10 * time.Minute)
|
||||
go defaultCache.StartCleanupWorker(defaultCleanupInterval)
|
||||
})
|
||||
return defaultCache
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user