1
我想給我的應用程序提供離線支持,並且我使用排球庫來解析來自jsonobject
的數據。我瞭解到凌空本身有一個很好的緩存機制。我已經實現此代碼以從緩存中獲取數據排球緩存總是在android中返回null
Cache cache = GlobalData.getInstance().getRequestQueue().getCache();
Cache.Entry entry = cache.get(Constants.URL_WEATHER_REQUEST + city);
但該條目始終返回空值。我聽說過的服務器站點的標題,我已經使用Mozilla的RESTClient實現addonn看起來像這樣測試它:
我不知道問題出在哪裏,但我總是得到緩存條目空,如果我像凌亂一樣對凌亂的網絡進行分析。我現在應該怎麼做?
請閱讀更多在[Android設定排球從緩存使用(http://stackoverflow.com/questions/31897189/android-setup-volley-to-use-from-cache/32022946#32022946) – BNK
我會的,但你能解釋這裏的錯誤嗎? – Reyjohn
也許你的服務器應用程序不允許緩存。你可以試試'Cache.Entry cacheEntry = HttpHeaderParser.parseCacheHeaders(response);'parseNetworkResponse'內部 – BNK