Android Objects Cache

后端 未结 7 1704
南旧
南旧 2020-12-14 23:14

Looking for a simple open source non-copyleft caching for Android (SDK 7+) class.

The purpose is primary to store the Bitmaps fetched asynchronously (so

相关标签:
7条回答
  • 2020-12-14 23:50

    Ignition is what are you looking for: https://github.com/kaeppler/ignition. It allows you to cache images, serialized objects. For cashing part, work with ignition-support

    Here's the API for ignition support: http://kaeppler.github.com/ignition-docs/ignition-support/apidocs/.

    0 讨论(0)
  • 2020-12-14 23:53

    The plain LruCache suggested above is an in memory cache. From your question it sounds like you are looking for a disk cache solution.

    Read the Disk Cache of the Caching Bitmaps android training doc.

    Then take a look at the DiskLruCache implementation discussed on the following thread : Using DiskLruCache in android 4.0 does not provide for openCache method

    You can grab the DiskLruCache source on GitHub.

    0 讨论(0)
  • 2020-12-14 23:54

    How about android.util.LruCache? If you need to support older platforms, simply copy it in you project. EDIT: it's actually in the compat/support library.

    0 讨论(0)
  • 2020-12-14 23:57

    You can create your own image cache following this official android documentation that not only gives you the code, but also explains how it works:

    http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

    They also explain the whole process, from loading bitmaps, processing them in a background thread, caching them and displaying them

    http://developer.android.com/training/displaying-bitmaps/index.html

    0 讨论(0)
  • 2020-12-14 23:59

    ICSDiskLruCache.java. This is a port of the DiskLruCache available in ICS and later versions of Android, open-sourced by Google as part of the IO 2012 Android App so it works with versions down to (at least) API level 7.

    Find the source at http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/ICSDiskLruCache.java

    0 讨论(0)
  • 2020-12-14 23:59

    http://docs.guava-libraries.googlecode.com/git-history/v12.0/javadoc/com/google/common/cache/package-summary.html

    0 讨论(0)
提交回复
热议问题