MCPcopy Create free account
hub / github.com/pydio/cells / cacheAdd

Method cacheAdd

common/nodes/sync/handler-sync-cache.go:153–167  ·  view source on GitHub ↗
(ctx context.Context, node *tree.Node)

Source from the content-addressed store, hash-verified

151}
152
153func (s *CacheHandler) cacheAdd(ctx context.Context, node *tree.Node) {
154 d, _ := json.Marshal(node)
155 log.Logger(ctx).Debug("Storing node to cache", node.Zap())
156 _ = s.getCtxCache(ctx).Set(cacheNodePrefix+node.GetPath(), d)
157 // Update diff
158 diff := NewCacheDiff()
159 dir := path.Dir(node.GetPath())
160 if diffDat, ok := s.getCtxCache(ctx).GetBytes(cacheDiffPrefix + dir); ok {
161 json.Unmarshal(diffDat, &diff)
162 }
163 diff.Adds[node.GetPath()] = struct{}{}
164 delete(diff.Deletes, node.GetPath())
165 diffDat, _ := json.Marshal(diff)
166 _ = s.getCtxCache(ctx).Set(cacheDiffPrefix+dir, diffDat)
167}
168
169func (s *CacheHandler) cacheDel(ctx context.Context, node *tree.Node) {
170 // Update diff

Callers 4

CreateNodeMethod · 0.95
UpdateNodeMethod · 0.95
PutObjectMethod · 0.95
MultipartCompleteMethod · 0.95

Calls 10

getCtxCacheMethod · 0.95
LoggerFunction · 0.92
NewCacheDiffFunction · 0.85
MarshalMethod · 0.65
DebugMethod · 0.65
ZapMethod · 0.65
SetMethod · 0.65
GetPathMethod · 0.65
GetBytesMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected