@_enable_lock<EOL><INDENT>def with_thread_pool(self, init_func=None, only_read=False):<DEDENT>
if not hasattr(self, '<STR_LIT>') or self.thread_pool is None:<EOL><INDENT>if init_func is not None:<EOL><INDENT>self.thread_pool = init_func()<EOL><DEDENT>else:<EOL><INDENT>self.thread_pool = _init_thread_pool()<EOL><DEDENT>self.enable_thread_pool = True<EOL>self.logger.debug('<STR_LIT>' % self.thread_pool)<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>self.logger.warning('<STR_LIT>' % self.thread_pool)<EOL>return False<EOL><DEDENT>
>>> cache = Cache(enable_thread_pool=False, log_level=logging.ERROR)
>>> cache.with_thread_pool()
True
>>> cache.with_thread_pool()
False