@classmethod<EOL><INDENT>def factory(cls, config, db):<DEDENT>
<EOL>if not hasattr(db, '<STR_LIT>'):<EOL><INDENT>LOG.debug("<STR_LIT>")<EOL>return GetBucketKeyByLock(config, db)<EOL><DEDENT>info = db.info()<EOL>if version_greater('<STR_LIT>', info['<STR_LIT>']):<EOL><INDENT>LOG.debug("<STR_LIT>")<EOL>return GetBucketKeyByScript(config, db)<EOL><DEDENT>LOG.debug("<STR_LIT>")<EOL>return GetBucketKeyByLock(config, db)<EOL>
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.