disklrumulticache

Simple multipurpose cache

License

License

GroupId

GroupId

it.sephiroth.android.library.disklrumulticache
ArtifactId

ArtifactId

disklrumulticache
Last Version

Last Version

1.0.8
Release Date

Release Date

Type

Type

aar
Description

Description

disklrumulticache
Simple multipurpose cache
Project URL

Project URL

https://github.com/sephiroth74/DiskLruImageCache
Source Code Management

Source Code Management

https://github.com/sephiroth74/DiskLruImageCache

Download disklrumulticache

How to add to project

<!-- https://jarcasting.com/artifacts/it.sephiroth.android.library.disklrumulticache/disklrumulticache/ -->
<dependency>
    <groupId>it.sephiroth.android.library.disklrumulticache</groupId>
    <artifactId>disklrumulticache</artifactId>
    <version>1.0.8</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/it.sephiroth.android.library.disklrumulticache/disklrumulticache/
implementation 'it.sephiroth.android.library.disklrumulticache:disklrumulticache:1.0.8'
// https://jarcasting.com/artifacts/it.sephiroth.android.library.disklrumulticache/disklrumulticache/
implementation ("it.sephiroth.android.library.disklrumulticache:disklrumulticache:1.0.8")
'it.sephiroth.android.library.disklrumulticache:disklrumulticache:aar:1.0.8'
<dependency org="it.sephiroth.android.library.disklrumulticache" name="disklrumulticache" rev="1.0.8">
  <artifact name="disklrumulticache" type="aar" />
</dependency>
@Grapes(
@Grab(group='it.sephiroth.android.library.disklrumulticache', module='disklrumulticache', version='1.0.8')
)
libraryDependencies += "it.sephiroth.android.library.disklrumulticache" % "disklrumulticache" % "1.0.8"
[it.sephiroth.android.library.disklrumulticache/disklrumulticache "1.0.8"]

Dependencies

compile (2)

Group / Artifact Type Version
commons-io : commons-io jar 2.4
com.jakewharton : disklrucache jar 2.0.2

Project Modules

There are no modules declared in this project.

DiskLruImageCache

Simple file based image cache

Include

Just add the following line to your build.gradle dependencies

compile "it.sephiroth.android.library.disklruimagecache:DiskLruImageCache:1.0.0"

Usage

DiskLruImageCache cache = new DiskLruImageCache( context, "my-unique-name", Integer.MAX_VALUE );

Read an entry from the cache

DiskLruImageCache.BitmapEntry entry = cache.get( "image-1", Metadata.class );

Write an entry

Metadata metadata = new Metadata();
metadata.value = 1;
DiskLruImageCache.BitmapEntry<Metadata> entry;
entry = new DiskLruImageCache.BitmapEntry<Metadata>( bitmap, metadata );
boolean success = cache.put( "image-1", entry, Bitmap.CompressFormat.JPEG, 70 );

The Metadata must be an instance of Parcelable, in this example is:

static class Metadata implements Parcelable {

	int value;

	public static final Parcelable.Creator<Metadata> CREATOR = new Parcelable.Creator<Metadata>() {
		public Metadata createFromParcel ( Parcel source ) {
			final Metadata f = new Metadata();
			f.value = source.readInt();
			return f;
		}

		@Override
		public Metadata[] newArray ( final int i ) {
			return new Metadata[0];
		}
	};

	@Override
	public int describeContents () {
		return 0;
	}

	@Override
	public void writeToParcel ( final Parcel parcel, final int i ) {
		parcel.writeInt( value );
	}
}

Versions

Version
1.0.8
1.0.6
1.0.5
1.0.3
1.0.2