Proper way to use PooledRedisClientManager in Plugins(GameServer)

Options
Sergey
Sergey
edited January 2019 in Photon Server
Hello!
Right now I'm using Singleton instance to get BasicRedisClientManager (ServiceStack.Redis)
When I create room I instantiate class where I keep methods with queries to Redis db(class Leaderboard). Through connector I define manager which is used to get clients for queries to db inside Leaderboard class. Example:
var lb = new Leaderboard(SingletonInstance.GetRedis())
Are there any another ways to use Redis Managers in Plugins? Using PooledRedisClientManager instead of BasicRedisClientManager causes some problems with connections (Can't really understand because of using singleton or not). If it possible I'd like to instantiate one PooledRedisClientManager and get clients from it. From any room.
Would be much appreciated for any advice and help!

Comments

  • chvetsov
    Options
    Hi, @Sergey

    You do not have to create a singleton instance. You could use your factory object to keep your global stuff. I do not know how to use the class you have described. Probably you need to synchronize access to it

    best,
    ilya
  • Sergey
    Options
    Okay, thanks a lof for an answer @chvetsov
    It will be really helpful for me!