MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / NewMemoryStorage

Function NewMemoryStorage

internal/caches/storage_memory.go:66–88  ·  view source on GitHub ↗
(policy *serverconfigs.HTTPCachePolicy, parentStorage StorageInterface)

Source from the content-addressed store, hash-verified

64}
65
66func NewMemoryStorage(policy *serverconfigs.HTTPCachePolicy, parentStorage StorageInterface) *MemoryStorage {
67 var dirtyChan chan string
68 var queueSize = policy.MemoryAutoFlushQueueSize
69
70 if parentStorage != nil {
71 if queueSize <= 0 {
72 queueSize = memutils.SystemMemoryGB() * 100_000
73 }
74
75 dirtyChan = make(chan string, queueSize)
76 }
77 return &MemoryStorage{
78 parentStorage: parentStorage,
79 policy: policy,
80 list: NewMemoryList(),
81 locker: &sync.RWMutex{},
82 valuesMap: map[uint64]*MemoryItem{},
83 dirtyChan: dirtyChan,
84 dirtyQueueSize: queueSize,
85 writingKeyMap: map[string]zero.Zero{},
86 ignoreKeys: setutils.NewFixedSet(32768),
87 }
88}
89
90// Init 初始化
91func (this *MemoryStorage) Init() error {

Calls 1

NewMemoryListFunction · 0.85