Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一些将 fakeredis gem 用于规范的代码,但是每当我从 REPL 运行这些规范时,fakeredis 就会留下来,并且像这样的命令Redis.new只会给我 fakeredis。我需要能够禁用它才能再次访问真正的 redis 存储。
Redis.new
有没有办法在 REPL 中禁用/启用它?
两种解决方案,要么去掉 fakeredis 内存类:
Redis::Connection.drivers.delete_if {|d| d == Redis::Connection::Memory }
或再次附加 Ruby 适配器:
Redis::Connection.drivers << Redis::Connection::Ruby
来源:https ://github.com/guilleiguaran/fakeredis/issues/63