def factory(cls, config, db):
        """
        Given a configuration and database, select and return an
        appropriate instance of a subclass of GetBucketKey.  This will
        ensure that both client and server support are available for
        the Lua script feature of Redis, and if not, a lock will be
        used.

        :param config: A dictionary of compactor options.
        :param db: A database handle for the Redis database.

        :returns: An instance of a subclass of GetBucketKey, dependent
                  on the support for the Lua script feature of Redis.
        """

        # Make sure that the client supports register_script()
        if not hasattr(db, 'register_script'):
            LOG.debug("Redis client does not support register_script()")
            return GetBucketKeyByLock(config, db)

        # OK, the client supports register_script(); what about the
        # server?
        info = db.info()
        if version_greater('2.6', info['redis_version']):
            LOG.debug("Redis server supports register_script()")
            return GetBucketKeyByScript(config, db)

        # OK, use our fallback...
        LOG.debug("Redis server does not support register_script()")
        return GetBucketKeyByLock(config, db)
Given a configuration and database, select and return an
        appropriate instance of a subclass of GetBucketKey.  This will
        ensure that both client and server support are available for
        the Lua script feature of Redis, and if not, a lock will be
        used.

        :param config: A dictionary of compactor options.
        :param db: A database handle for the Redis database.

        :returns: An instance of a subclass of GetBucketKey, dependent
                  on the support for the Lua script feature of Redis.