(self)
Checks if cache should be refreshed, and refreshes it if needed.
        Returns True if the cache was refreshed, False otherwise.
Checks if cache should be refreshed, and refreshes it if needed.
        Returns True if the cache was refreshed, False otherwise.
Checks if cache should be refreshed and refreshes it if needed . Returns True if the cache was refreshed False otherwise .
def refresh(self):
        """Checks if cache should be refreshed, and refreshes it if needed.
        Returns True if the cache was refreshed, False otherwise."""

        # Acquire the write lock to check whether to refresh because we're
        # going to keep it to do the refresh, AND, we don't want multiple
        # threads getting a `yes` result at once
        with self.write_lock():
            if self._should_refresh():
                self.elements = [proc for proc in psutil.process_iter(attrs=['pid', 'name'])]
                self.last_ts = time.time()
                return True
            else:
                return False
def refresh ( self ) : # Acquire the write lock to check whether to refresh because we're # going to keep it to do the refresh, AND, we don't want multiple # threads getting a `yes` result at once with self . write_lock ( ) : if self . _should_refresh ( ) : self . elements = [ proc for proc in psutil . process_iter ( attrs = [ 'pid' , 'name' ] ) ] self . last_ts = time . time ( ) return True else : return False