I just released the version 2.0.0 of my Android library for caching. Tired to choose between DiskLruCache and LruCache ? Simply use this android lib and get the best of disk and RAM caching.
Find everything you need about the dual cache on the github page.
October 2, 2015 at 8:56 pm
There is a practical example of this library?
November 12, 2015 at 4:35 pm
Hi, the app module is a showcase of the library. Btw, the tests are also featuring all the usages of the library.
March 23, 2016 at 10:34 am
http://stackoverflow.com/questions/28255514/any-way-to-cache-query-results-from-google-cloud-endpoints/34248852#34248852
March 27, 2016 at 5:19 pm
I am glad my library solved your issue 😉
May 11, 2016 at 10:52 pm
Hi,
I’m getting this
“The context provided to this library is null. Please provide a proper context according the lifecycle of the application (you should provide the application context).” How to provide context?
May 15, 2016 at 7:08 pm
Hi,
You could use getApplicationContext() as Context.
BR
May 15, 2016 at 2:43 pm
hey vincent
i have been trying to use your caching library in my project and it is not working, i gave up after trying a lot .
here is my code
private CacheLibrary(Context context){
mContext = context;
DualCacheContextUtils.setContext(mContext);
DualCacheLogUtils.enableLog();
/* mRamCacheSize = intent.getIntExtra(EXTRA_RAM_CACHE_SIZE,50);
mDiskCacheSize = intent.getIntExtra(EXTRA_DISK_CACHE_SIZE, 100);
mCacheId = intent.getStringExtra(EXTRA_ID_CACHE);*/
mCache = new DualCacheBuilder(“cache_Id1”, 2, String.class).useDefaultSerializerInRam(50).useDefaultSerializerInDisk(100,true);
// enableDiskBuilder();
// mCache = mDualCacheDiskBuilder.noDisk(); // bydefault disk caching would be disabled because some module would be eligible for sqlite caching not disk
}
public void setCache(String key,Object value)
{
if(key!=null || value!=null ){
mCache.put(key, value.toString());
}
}
public Object getCache(String key)
{
String cacheResp =mCache.get(key);
Object obj =null;
if(cacheResp!=null){
try{
obj = new JSONTokener(cacheResp).nextValue();
if(obj instanceof JSONObject)
{
obj = new JSONObject(obj.toString());
}
else
{
obj = new JSONArray(obj.toString());
}
}catch (JSONException jsonExp)
{
KaHOLog.writeErrorLog(“There is an error while retriving the data from cache”);
}
}
return obj;
}
cacheLibrary.setCache(“my_cache”,response);
but everytime it is returning empty
May 15, 2016 at 7:14 pm
Hi,
Please open an issue here https://github.com/vincentbrison/android-easy-cache/issues and I will look into it 😉
Br,
Vincent