I'm using rails 2.3.8 and redis.
In my controllers, each time I want to access redis, I will create a new Redis object, like:
class AbcController < ApplicationController
def index
redis => Redis.new
redis.xxx
end
def list
redis => Redis.new
redis.xxx
end
end
I feel this is very bad, and I have some questions here:
Can we create ONE Redis object in somewhere, and we can use it directly anywhere? If yes, how to do it?
Do we need to close(disconnect) the redis object after operation?