boost::redis::request::punsubscribe :: Boost.Redis

# boost::redis::request::punsubscribe

Appends a PUNSUBSCRIBE command to the end of the request.

## Synopsis

Declared in `<boost/redis/request.hpp>`

    template<class ForwardIt>
    void
    punsubscribe(
        ForwardIt patterns_begin,
        ForwardIt patterns_end);

## Description

[`patterns_begin`, `patterns_end`) should point to a valid] range of elements convertible to `std::string_view`. If the range contains `["news._", "events._"]`, the resulting command is `PUNSUBSCRIBE news.* events.*`.

Subscriptions removed using this function are tracked to enable PubSub state restoration. After successfully executing the request, the connection will store any newly subscribed channels and patterns. Every time a reconnection happens, a suitable `SUBSCRIBE`/`PSUBSCRIBE` command is issued automatically, to restore the subscriptions that were active before the reconnection.

PubSub store restoration only happens when using `subscribe`, `unsubscribe`, `psubscribe` or `punsubscribe`. Subscription commands added by `push` or `push_range` are not tracked.

Created with MrDocs