MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / AsSingleChannelCache

Function AsSingleChannelCache

db/channel_cache.go:359–366  ·  view source on GitHub ↗

Converts an RangeSafeCollection value to a singleChannelCacheImpl. On type conversion error, logs a warning and returns nil.

(ctx context.Context, cacheValue interface{})

Source from the content-addressed store, hash-verified

357// Converts an RangeSafeCollection value to a singleChannelCacheImpl. On type
358// conversion error, logs a warning and returns nil.
359func AsSingleChannelCache(ctx context.Context, cacheValue interface{}) *singleChannelCacheImpl {
360 singleChannelCache, ok := cacheValue.(*singleChannelCacheImpl)
361 if !ok {
362 base.WarnfCtx(ctx, "Unexpected channel cache value type: %T", cacheValue)
363 return nil
364 }
365 return singleChannelCache
366}
367
368// Adds a new channel to the channel cache. Locking seqLock is required here to prevent missed data in the following scenario:
369//

Callers 7

RemoveMethod · 0.85
cleanAgedItemsMethod · 0.85
getChannelCacheMethod · 0.85
addChannelCacheMethod · 0.85
getActiveChannelCacheMethod · 0.85
MaxCacheSizeMethod · 0.85

Calls 1

WarnfCtxFunction · 0.92

Tested by 1