echo_database.go 635 B

123456789101112131415161718192021222324252627282930
  1. // Author: simon (ynwdlxm@163.com)
  2. // Date: 2025/9/12 14:57
  3. // Desc:
  4. package database
  5. import (
  6. "github.com/runningwater/go-redis/interface/resp"
  7. "github.com/runningwater/go-redis/lib/logger"
  8. "github.com/runningwater/go-redis/resp/reply"
  9. )
  10. type EchoDatabase struct {
  11. }
  12. func NewEchoDatabase() *EchoDatabase {
  13. return &EchoDatabase{}
  14. }
  15. func (e *EchoDatabase) Exec(_ resp.Connection, args [][]byte) resp.Reply {
  16. return reply.NewMultiBulkReply(args)
  17. }
  18. func (e *EchoDatabase) Close() {
  19. logger.Info("database closed")
  20. }
  21. func (e *EchoDatabase) AfterClientClose(_ resp.Connection) {
  22. logger.Info("client closed, AfterClientClose")
  23. }