Akavache icon indicating copy to clipboard operation
Akavache copied to clipboard

feature: Title

Open Vuyiswamb opened this issue 5 years ago • 0 comments

Good Day Everyone one

i have installed the following Packages in my Standard Project, Android and ios

SQLitePCLRaw.bundle_green akavache.sqlite3

and i have static class with the following functions

public   static USERS_Model  RetrieveUserInfo()
        {
            USERS_Model Userinfo = null; 
            try
            {

                try
                {

                    Registrations.Start("mykey");  
                     BlobCache.LocalMachine.GetObject<USERS_Model>("userdata")
                    .Subscribe(x => Userinfo = x, ex => Console.WriteLine("No Key!"));

                }
                catch (KeyNotFoundException ex)
                {
                    Userinfo = new USERS_Model();
                } 
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("The given key 'userdata' was not present in the cache"))
                {
                    Userinfo = null;
                }
            }
            return Userinfo;
        }
public static  void StoreData(USERS_Model model)
       {
           if (USER_DATA != null)
           { 
               try
               {
                   Registrations.Start("mykey");
                   BlobCache.LocalMachine.InsertObject<USERS_Model>("userdata", model);


               }
               catch (KeyNotFoundException ex)
               {
                   throw ex;
               }
           }
       }

and have init on the platforms like this

Akavache.Sqlite3.Registrations.Start("mykey", () => SQLitePCL.Batteries_V2.Init());

When i save data and close the app and open it again , i dont get the data, it returns null , what could be the problem

Thanks

Vuyiswamb avatar Oct 13 '20 20:10 Vuyiswamb