MCPcopy
hub / github.com/uber/aresdb / updateCache

Method updateCache

controller/mutators/etcd/enum_mutator.go:227–245  ·  view source on GitHub ↗
(cacheKey string, nodeID int, dict map[string]int)

Source from the content-addressed store, hash-verified

225}
226
227func (e *enumMutator) updateCache(cacheKey string, nodeID int, dict map[string]int) {
228 e.Lock()
229 cache, ok := e.enumCacheMap[cacheKey]
230 if !ok {
231 cache = enumCache{
232 enumCases: make(map[string]int),
233 }
234 }
235 // update currentNodeID for cache
236 cache.currentNodeID = nodeID
237 // merge newEnumCaseDict to cache
238 for enumCase, enumID := range dict {
239 if _, exist := cache.enumCases[enumCase]; !exist {
240 cache.enumCases[enumCase] = enumID
241 }
242 }
243 e.enumCacheMap[cacheKey] = cache
244 e.Unlock()
245}
246
247func (e *enumMutator) GetEnumCases(namespace, tableName, columnName string) ([]string, error) {
248 schema, err := e.schemaMutator.GetTable(namespace, tableName)

Callers 2

extendEnumCaseMethod · 0.95
GetEnumCasesMethod · 0.95

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected