Back to project page dn-rss.
The source code is released under:
MIT License
If you think the Android project dn-rss listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package kaka.android.dn; //w ww .j a va2 s.c o m public class Cache<T> { private String key; public Cache(String key) { this.key = key; } /** * @return true on success, false on failure */ public boolean save(T object) { try { App.sharedPreferences().edit().putString(key, Utils.serializeToString(object)).commit(); return true; } catch (Exception e) { App.log.e(this, String.format("Failed to save to cache '%s'", key), e); } return false; } @SuppressWarnings("unchecked") public T load() { String s = App.sharedPreferences().getString(key, null); if (s != null) { try { return (T)Utils.deserializeFromString(s); } catch (Exception e) { App.log.e(this, String.format("Failed to load from cache '%s'", key), e); } } return null; } }