// PING func (m *Redico) cmdPing(out *redeo.Responder, r *redeo.Request) error { if !m.handleAuth(r.Client(), out) { return nil } out.WriteInlineString("PONG") return nil }
// withTx wraps the non-argument-checking part of command handling code in // transaction logic. func withTx( m *Redico, out *redeo.Responder, r *redeo.Request, cb txCmd, ) error { ctx := getCtx(r.Client()) if inTx(ctx) { addTxCmd(ctx, cb) out.WriteInlineString("QUEUED") return nil } m.Lock() defer m.Unlock() cb(out, ctx) return nil }
// TYPE func (m *Miniredis) cmdType(out *redeo.Responder, r *redeo.Request) error { if len(r.Args) != 1 { setDirty(r.Client()) out.WriteErrorString("usage error") return nil } if !m.handleAuth(r.Client(), out) { return nil } key := r.Args[0] return withTx(m, out, r, func(out *redeo.Responder, ctx *connCtx) { db := m.db(ctx.selectedDB) t, ok := db.keys[key] if !ok { out.WriteInlineString("none") return } out.WriteInlineString(t) }) }
func pingCmd(out *redeo.Responder, _ *redeo.Request) error { out.WriteInlineString("PONG") return nil }
// PING func (m *Miniredis) cmdPing(out *redeo.Responder, r *redeo.Request) error { out.WriteInlineString("PONG") return nil }