MCPcopy
hub / github.com/gofiber/fiber / New

Function New

internal/storage/memory/memory.go:35–52  ·  view source on GitHub ↗

New creates a new memory storage.

(config ...Config)

Source from the content-addressed store, hash-verified

33
34// New creates a new memory storage.
35func New(config ...Config) *Storage {
36 // Set default config
37 cfg := configDefault(config...)
38
39 // Create storage
40 store := &Storage{
41 db: make(map[string]Entry),
42 gcInterval: cfg.GCInterval,
43 done: make(chan struct{}),
44 gcExited: make(chan struct{}),
45 }
46
47 // Start garbage collector
48 utils.StartTimeStampUpdater()
49 go store.gc()
50
51 return store
52}
53
54// Get returns the stored value for key, ignoring missing or expired entries by
55// returning nil.

Calls 2

gcMethod · 0.95
configDefaultFunction · 0.70