@_enable_lock<EOL><INDENT>def set_capacity(self, new_capacity, only_read=False):<DEDENT>
if not isinstance(new_capacity, int) or new_capacity <= <NUM_LIT:0>:<EOL><INDENT>self.logger.warning('<STR_LIT>' % new_capacity)<EOL>return<EOL><DEDENT>self.capacity = new_capacity<EOL>
>>> cache = Cache(log_level=logging.WARNING)
>>> cache.set_capacity(100)
>>> cache.capacity
100
>>> cache.set_capacity('haha')
>>> cache.capacity
100