robospice icon indicating copy to clipboard operation
robospice copied to clipboard

SpiceManager.removeAllDataFromCache() doesn't work

Open joelmoura opened this issue 11 years ago • 3 comments

Version 1.4.12

I'm developing an app, that stores all messages in cache for 5 minutes:

getSpiceManager().execute(spiceRequestCheckingAccounts,
                "ServiceCurrentAccountsList",
                DEFAULT_CACHE_DURATION,
                spiceListenerCheckingAccounts);

Where spiceRequestCheckingAccounts is GSON object.

At the startup of the application (new session), I call

getSpiceManager().removeAllDataFromCache()

but it doesn't remove the previous messages.

Does anyone have a similar issue? Is this a bug?

joelmoura avatar Jun 18 '14 18:06 joelmoura

Is it the same instance of SpiceManager, or at least 2 instances related to the same service class ?

Question is marked as invalid as we need more details. If you had a test that fails, that would help too.

stephanenicolas avatar Jun 20 '14 13:06 stephanenicolas

it is 2 different instances... each block of code i wrote before, are in different activities.

Unfortunately, I'm not able to provide a test...

After a lot of tries, I have managed to find a solution.

        getSpiceManager().removeAllDataFromCache();
        try {
            FileUtils.cleanDirectory(getActivity().getCacheDir());
        } catch (IOException e) {
            Log.e(TAG, "Could not clean cache directory: " + e.getMessage());
        }

Ofc,this erases all the app's cache. Is not the perfect solution.

joelmoura avatar Jun 23 '14 15:06 joelmoura

Does it happen all the time (that it doesn't work) or under uncertain and hard to reproduce circomstances ?

stephanenicolas avatar Jun 23 '14 16:06 stephanenicolas