Clear Sync Gateway Cache


#1

Hi,

We have an issue with sync gateway cache.

We are using sync gateway with user email as their channel.
Example: I have 50 documents in my account and I am logged in and using the application. So documents are synced to the local database.
If I remove local database (without deleting the documents) and flush data from couchbase server and again sign up with same details as previous account (i.e: email address would be same, so channel would also be same) then in that case users previous 50 documents are synced as well. Instead we don’t want to show any previous documents to the user as this would be user’s new account.

So we wanted to know if there is a way to remove these documents from sync gateway cache where these documents are stored for quicker access whenever required.

Thanks,
Ajinkya


#2

If I remove local database (without deleting the documents) and flush data from couchbase server

Can you expand a little bit on what the “flush data” process does?

Instead we don’t want to show any previous documents to the user as this would be user’s new account.

What about naming the channel something like {doc.email}.{uuid}. uuid would be a unique identifier that’s created when the user signs up.

But if the user asked to delete their account then you should probably delete the data on the server side as well. Then, calling the channel “{doc.email}” wouldn’t be a problem because the docs from the previous account would already be removed. That’s why I’m curious to understand what happens currently when the user removes their account.

James