Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

There is no option to clean the cache. #123

Open
qianshengta opened this issue May 21, 2018 · 3 comments
Open

There is no option to clean the cache. #123

qianshengta opened this issue May 21, 2018 · 3 comments

Comments

@qianshengta
Copy link

    @LifeCache(duration = 60, timeUnit = TimeUnit.MINUTES)
    Observable<Reply<HttpResponse<LoginUsr>>> testCacheForOneClearGroupTwoWith
    (Observable<HttpResponse<LoginUsr>> observable, DynamicKeyGroup dynamicKeyGroup,
     EvictProvider evictProvider);

This is my API.According to the document.The difference in the incoming "EvictProvider "can achieve the purpose of a selective cleanup cache.
For Example:
If I pass in "EvictDynamicKeyGroup", he will clear the cache in detail (key1,key2).
If I pass in "EvictDynamicKey", he will clear all caches under (key1).
If I pass in "EvictProvider", he will clear all caches under the API.
But what I'm trying to do is, regardless of what I'm passing in, he's just going to clear a cache of exactly what's going on (key1, key2)?

    RequestFactory.getStartCacheRequest().testCacheForOneClearGroupTwoWith(new
                HttpRxObservable<LoginUsr>().getObservable(RequestFactory.getStartRequest()
                .testForOne(token), provider), new DynamicKeyGroup(key, keyTwo), new
                EvictDynamicKey(isClear)).subscribe(StartObserverRepository.testForOneObserver
                (provider, callBack));

        RequestFactory.getStartCacheRequest().testCacheForOneClearGroupTwoWith(new
                HttpRxObservable<LoginUsr>().getObservable(RequestFactory.getStartRequest()
                .testForOne(token), provider), new DynamicKeyGroup(key, keyTwo), new
                EvictProvider(isClear)).subscribe(StartObserverRepository.testForOneObserver
                (provider, callBack));
@qianshengta
Copy link
Author

qianshengta commented May 22, 2018

I think I've found the problem, although I don't know how to avoid it?
As for my previous questions, I did a more detailed test and found out.

The problem is that every time I create a new cache, I exit the app, modify the parameters in the code, and then restart the app to create a new cache.That's what caused my problem., after I changed my operation in the interface of a set of four buttons, three to create different page caching, a clear cache, in an app in the life cycle of a finish operation, can achieve the desired effect, when introduced into "EvictProvider" clean all the cache, when introduced into "EvictDynamicKey" back to clean up key1 under all the cache

Do you think this is a bug, because such caching, again after exit the app I enter, I refresh action into "EvictProvider (true)" to clear all cache didn't effect, obtain the remains of the old data if cache time not expired

@VictorAlbertos

@pcg92
Copy link

pcg92 commented Jan 21, 2019

Is not possible to restart/refresh the cache?

@sevaktahmazyan
Copy link

I also came across to that problem. To solve this I clean the directory whit I provide for caching data. But after that you must create new instance of the cache provider if its is singleton for you because after cleaning the cache directory provider return error can not read data because it does not exist.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants