MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / CacheGetChannelInfo

Function CacheGetChannelInfo

model/channel_cache.go:344–363  ·  view source on GitHub ↗
(id int)

Source from the content-addressed store, hash-verified

342}
343
344func CacheGetChannelInfo(id int) (*ChannelInfo, error) {
345 if !common.MemoryCacheEnabled {
346 channel, err := GetChannelById(id, true)
347 if err != nil {
348 return nil, err
349 }
350 return &channel.ChannelInfo, nil
351 }
352 channelSyncLock.RLock()
353 defer channelSyncLock.RUnlock()
354
355 c, ok := channelsIDM[id]
356 if !ok {
357 return nil, fmt.Errorf("渠道# %d,已不存在", id)
358 }
359 if c.Status != common.ChannelStatusEnabled {
360 return nil, fmt.Errorf("渠道# %d,已被禁用", id)
361 }
362 return &c.ChannelInfo, nil
363}
364
365func CacheUpdateChannelStatus(id int, status int) {
366 if !common.MemoryCacheEnabled {

Callers 1

GetNextEnabledKeyMethod · 0.85

Calls 1

GetChannelByIdFunction · 0.85

Tested by

no test coverage detected