GithubHelp home page GithubHelp logo

Comments (5)

agentzh avatar agentzh commented on August 17, 2024

@cbarraford Just use the select() method to choose which "database" to use. See the original redis documentation for the corresponding select command for more details:

http://redis.io/commands/SELECT

from lua-resty-redis.

cbarraford avatar cbarraford commented on August 17, 2024

Thanks. But I was hoping for a way to connect to a specific db. Not connect to db 0 and switch to db 1 everytime I connect. 


Sent from Mailbox

On Sat, Nov 15, 2014 at 2:03 PM, Yichun Zhang [email protected]
wrote:

@cbarraford Just use the select() method to choose which "database" to use. See the original redis documentation for the corresponding select command for more details:

http://redis.io/commands/SELECT

Reply to this email directly or view it on GitHub:
#53 (comment)

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

@cbarraford You can check if the connection comes from the connection pool by means of the get_reused_times method. You only need to run the select command if it is a newly established connection.

BTW, if you have connections to different databases (but to the same redis server), then you also need separate connection pools for different databases (by specifying the "pool" option of the connect method).

from lua-resty-redis.

cbarraford avatar cbarraford commented on August 17, 2024

Thanks. 


Sent from Mailbox

On Mon, Nov 17, 2014 at 2:48 PM, Yichun Zhang [email protected]
wrote:

@cbarraford You can check if the connection comes from the connection pool by means of the get_reused_times method. You only need to run the select command if it is a newly established connection.

BTW, if you have connections to different databases (but to the same redis server), then you also need separate connection pools for different databases (by specifying the "pool" option of the connect method).

Reply to this email directly or view it on GitHub:
#53 (comment)

from lua-resty-redis.

dromer avatar dromer commented on August 17, 2024

I tried red:select(4) but it still saved data in db0.

from lua-resty-redis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.