def __init__(self, basename, use_locks=False):
if not os.path.isdir(basename):<EOL><INDENT>raise ValueError("<STR_LIT>" % basename)<EOL><DEDENT>self.basename = basename<EOL>self.use_locks = use_locks<EOL>self.lock_update = threading.RLock() if use_locks else gensim.utils.nocm<EOL>try:<EOL><INDENT>self.fresh_index = SimIndex.load(self.location('<STR_LIT>'))<EOL><DEDENT>except:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>self.fresh_index = None<EOL><DEDENT>try:<EOL><INDENT>self.opt_index = SimIndex.load(self.location('<STR_LIT>'))<EOL><DEDENT>except:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>self.opt_index = None<EOL><DEDENT>try:<EOL><INDENT>self.model = SimModel.load(self.location('<STR_LIT>'))<EOL><DEDENT>except:<EOL><INDENT>self.model = None<EOL><DEDENT>self.payload = SqliteDict(self.location('<STR_LIT>'), autocommit=True, journal_mode=JOURNAL_MODE)<EOL>self.flush(save_index=False, save_model=False, clear_buffer=True)<EOL>logger.info("<STR_LIT>" % self)<EOL>
All data will be stored under directory `basename`. If there is a server
there already, it will be loaded (resumed).

The server object is stateless in RAM -- its state is defined entirely by its location.
There is therefore no need to store the server object.