1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-01 16:06:54 +03:00

Add cache writing

This commit is contained in:
ofekshenawa
2024-03-03 11:20:05 +02:00
parent e9b162945b
commit 05aae206bb
10 changed files with 118 additions and 46 deletions

View File

@ -63,6 +63,10 @@ func (cn *Conn) RemoteAddr() net.Addr {
return nil
}
func (cn *Conn) GetRawOutput() []byte {
return cn.rd.GetLine()
}
func (cn *Conn) WithReader(
ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error,
) error {

View File

@ -40,6 +40,8 @@ const (
const Nil = RedisError("redis: nil") // nolint:errname
var Line []byte
type RedisError string
func (e RedisError) Error() string { return string(e) }
@ -120,7 +122,7 @@ func (r *Reader) ReadLine() ([]byte, error) {
if IsNilReply(line) {
return nil, Nil
}
Line = line
return line, nil
}
@ -151,6 +153,10 @@ func (r *Reader) readLine() ([]byte, error) {
return b[:len(b)-2], nil
}
func (r *Reader) GetLine() []byte {
return Line
}
func (r *Reader) ReadReply() (interface{}, error) {
line, err := r.ReadLine()
if err != nil {