Exemple #1
0
// FilterMC installs a counter Memcache filter in the context.
func FilterMC(c context.Context) (context.Context, *MCCounter) {
	state := &MCCounter{}
	return mc.AddRawFilters(c, func(ic context.Context, mc mc.RawInterface) mc.RawInterface {
		return &mcCounter{state, mc}
	}), state
}
Exemple #2
0
// FilterMC installs a featureBreaker mc filter in the context.
func FilterMC(c context.Context, defaultError error) (context.Context, FeatureBreaker) {
	state := newState(defaultError)
	return mc.AddRawFilters(c, func(ic context.Context, rds mc.RawInterface) mc.RawInterface {
		return &mcState{state, rds}
	}), state
}