def read(self):
<EOL>if self._cache:<EOL><INDENT>img = self._cache.get(self._position)<EOL>if img is not None:<EOL><INDENT>ret = True<EOL><DEDENT>else:<EOL><INDENT>if self._position != self._get_real_position():<EOL><INDENT>self._set_real_position(self._position)<EOL><DEDENT>ret, img = self._vcap.read()<EOL>if ret:<EOL><INDENT>self._cache.put(self._position, img)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>ret, img = self._vcap.read()<EOL><DEDENT>if ret:<EOL><INDENT>self._position += <NUM_LIT:1><EOL><DEDENT>return img<EOL>
Read the next frame.

        If the next frame have been decoded before and in the cache, then
        return it directly, otherwise decode, cache and return it.

        Returns:
            ndarray or None: Return the frame if successful, otherwise None.