Remove and return the first item queue. .. warning:: This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseQueue.pop` instead. Args: key (str): The key for the queue document. **kwargs (Dict[str, An
(self, key: str, **kwargs: object)
| 1758 | return self.list_prepend(key, value, create=create, **kwargs) |
| 1759 | |
| 1760 | def queue_pop(self, key: str, **kwargs: object) -> OperationResult: |
| 1761 | """Remove and return the first item queue. |
| 1762 | |
| 1763 | .. warning:: |
| 1764 | This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseQueue.pop` |
| 1765 | instead. |
| 1766 | |
| 1767 | Args: |
| 1768 | key (str): The key for the queue document. |
| 1769 | **kwargs (Dict[str, Any]): keyword arguments that can be used as optional parameters |
| 1770 | for this operation. |
| 1771 | |
| 1772 | Returns: |
| 1773 | :class:`~couchbase.result.OperationResult`: An instance of :class:`~couchbase.result.OperationResult`. |
| 1774 | |
| 1775 | Raises: |
| 1776 | :class:`~couchbase.exceptions.DocumentNotFoundException`: If the key provided does not exist |
| 1777 | on the server. |
| 1778 | """ |
| 1779 | while True: |
| 1780 | try: |
| 1781 | itm = self.list_get(key, -1, **kwargs) |
| 1782 | except IndexError: |
| 1783 | raise QueueEmpty |
| 1784 | |
| 1785 | kwargs.update({k: v for k, v in getattr( |
| 1786 | itm, '__dict__', {}).items() if k in {'cas'}}) |
| 1787 | try: |
| 1788 | self.list_remove(key, -1, **kwargs) |
| 1789 | return itm |
| 1790 | except DocumentExistsException: |
| 1791 | pass |
| 1792 | except IndexError: |
| 1793 | raise QueueEmpty |
| 1794 | |
| 1795 | def queue_size(self, key: str) -> int: |
| 1796 | """Get the length of a queue. |