-
-
Notifications
You must be signed in to change notification settings - Fork 284
Open
Labels
Description
Describe the bug ๐
Calling CacheDatabase.UserAccount.InvalidateAll() on iOS or Android followed by Flush and Vacuum does not remove entries from cache.
Calling CacheDatabase.UserAccount.Invalidate(key) or CacheDatabase.UserAccount.InvalidateObject(key) followed by Flush and Vacuum does not work on iOS, but does work on Android.
Step to reproduce
Using Akavache 11.4.1
using Akavache;
using Akavache.Sqlite3;
using Akavache.SystemTextJson;
Android or iOS
var key = "entry_key"
var entry = new Entry();
await CacheDatabase.UserAccount.InsertObject(key, entry).ToTask();
await CacheDatabase.UserAccount.Flush().ToTask();
await CacheDatabase.UserAccount.InvalidateAll().ToTask();
await CacheDatabase.UserAccount.Flush().ToTask();
await CacheDatabase.UserAccount.Vacuum().ToTask();
var cachedEntry = await CacheDatabase.UserAccount.GetObject<Entry>(key).FirstOrDefaultAsync().Catch(Observable.Return<Entry>(null)).ToTask().CaptureContext();
if (cachedEntry != null)
{
throw new Exception("Found cached entry when we should have received null")
}
iOS
var key = "entry_key"
var entry = new Entry();
await CacheDatabase.UserAccount.InsertObject(key, entry).ToTask();
await CacheDatabase.UserAccount.Flush().ToTask();
await CacheDatabase.UserAccount.Invalidate(key).ToTask();
// OR
// await CacheDatabase.UserAccount.InvalidateObject<Entry>(key).ToTask();
await CacheDatabase.UserAccount.Flush().ToTask();
await CacheDatabase.UserAccount.Vacuum().ToTask();
var cachedEntry = await CacheDatabase.UserAccount.GetObject<Entry>(key).FirstOrDefaultAsync().Catch(Observable.Return<Entry>(null)).ToTask();
if (cachedEntry != null)
{
throw new Exception("Found cached entry when we should have received null")
}
Reproduction repository
No response
Expected behavior
When calling InvalidateAll the cache should be purged of all objects.
When calling Invalidate or InvalidateObject on iOS, the cache should be purged of the object matching the key.
Screenshots ๐ผ๏ธ
No response
IDE
Visual Studio 2022
Operating system
Windows 11 / Mac OS
Version
No response
Device
iPhone, Android
ReactiveUI Version
No response
Additional information โน๏ธ
I'm using InvalidateAll to clear my cache on app Logout, but the data is being preserved. I've only tested UserAccount.
Syed-RI