# SyncManager is caching the messages even if I logout and login

**URL:** <https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631>\
**Category:** Android\
**Tags:** syncmanager, chatsdk\
**Created:** [January 27, 2021, 11:21am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631 "2021-01-27T11:21:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tej](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tej](https://community.sendbird.com/u/Tej)\
**Post date:** [January 27, 2021, 11:21am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631/1 "2021-01-27T11:21:12Z")

</div>

I have implemented the SyncManager for offline support of the chat. Now when I send messages in the offline and then when I logout of the app. Then in online mode if I login back to app I see that the messages sent in offline(which were failed) retries and sends. When I logout of the app I close the SendBird connection, clear cache; but also messages are being cached.

I want the messages( **failed messages only** ) to get cleared when the user logout of the app. How can this be achieved. Please help.

---

<div class="post-metadata">

**Author:** ![sardorbek.numonov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/sardorbek.numonov/32/697_2.png) [@sardorbek.numonov](https://community.sendbird.com/u/sardorbek.numonov)\
**Post date:** [January 28, 2021, 12:18am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631/2 "2021-01-28T00:18:35Z")

</div>

Hi @Tej, Could you tell me Sendbird SDK and SyncManager SDK version which you used, please?

---

<div class="post-metadata">

**Author:** ![hoons](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/hoons/32/77_2.png) [@hoons](https://community.sendbird.com/u/hoons)\
**Post date:** [January 28, 2021, 1:47am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631/3 "2021-01-28T01:47:56Z")

</div>

Hi @Tej ,

The SyncManagerSDK does not provide a way for removing cache only for failed messages. The SDK keeps cached messages until `SendBirdSyncManager.clearCache()` is called, which removes all cached channels and messages.

It seems like your `Options.MessageResendPolicy` is `AUTOMATIC`, since you mentioned it being sent when you login in online mode, so you can change the policy to `MANUAL` if you don’t want it to be resent automatically.

Thank you.

---

<div class="post-metadata">

**Author:** ![Tej](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tej](https://community.sendbird.com/u/Tej)\
**Post date:** [January 28, 2021, 4:59am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631/4 "2021-01-28T04:59:06Z")

</div>

Hi @sardorbek.numonov thanks for the reply, my SendBird SDK and SyncManager SDK versions are _ **com.sendbird.sdk:sendbird-android-sdk:3.0.148** _  
_ **com.sendbird.sdk:sendbird-syncmanager:1.1.26** _

---

<div class="post-metadata">

**Author:** ![Tej](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tej](https://community.sendbird.com/u/Tej)\
**Post date:** [January 28, 2021, 5:02am UTC](https://community.sendbird.com/t/syncmanager-is-caching-the-messages-even-if-i-logout-and-login/1631/5 "2021-01-28T05:02:50Z")

</div>

Hi @hoons , thanks for the reply, but when I call the **SendBirdSyncManager.clearCache()** also the old messages are not getting cleared. And I want the ResendPolicy as Automatic only because I want to make sure the message are retired but when I logout of my app all the data should be cleared.
