def set_capacity(self, new_capacity, only_read=False):
        """
        >>> cache = Cache(log_level=logging.WARNING)
        >>> cache.set_capacity(100)
        >>> cache.capacity
        100
        >>> cache.set_capacity('haha')
        >>> cache.capacity
        100
        """
        if not isinstance(new_capacity, int) or new_capacity <= 0:
            self.logger.warning('Parameter new_capacity %s must be greater than 0 and is an integer' % new_capacity)
            return
        self.capacity = new_capacity