Skip to content

A simple, powerfull, and multipurpose java caching library with both memory and disk persisting ability. Save your POJO's directly in the cache

License

Notifications You must be signed in to change notification settings

ErrorxCode/Clorine

Repository files navigation


Markdownify
Clorine

A child's play LRU In-memory & disk caching library for java apps.

Key FeaturesHow To UseImplimentation

Markdownify

Clorine is a simple and easy to use caching library for java. It uses LRU (Least recently used) algorithim for saving and deleting cache. This library facilates In-memory cache along with disk cache. Means that your cache is actually sotred on the disk but a another in-memory cache is also created when you use that cache frequently to save time.

🎯Key Features

  • Super simple, made using the most simples design ever
  • Automatically manage the cache heap and memory
  • Can directly cache objects (POJO's)

💉Implimentation

Gradle :-

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.ErrorxCode:Clorine:Tag'
	}

Maven :-

Step 1. Add to project level file

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Step 2. Add the dependency

	<dependency>
	    <groupId>com.github.ErrorxCode</groupId>
	    <artifactId>Clorine</artifactId>
	    <version>Tag</version>
	</dependency>

📃Usage

The usage of this library is this much simple that it cannot be explained in words.

First create a cache:

Cache demo = Clorine.createOrOpen(20,"demo",cacheDir);

20 is the limit of data/objects in the memory cache. There is no limit in disk cache.

Then use it like this:

// To store cache, you don't need to do anything else
cache.put("name","xcode");  
cache.put("person1",new Person("xcode",5,false));  
cache.put("person2",new Person("frank",42,true));

// To get data
cache.get("name",String.class);  
cache.get("person",Person.class);

🆘Support

If you like my work then you can suppot me by giving this repo a ⭐. You can check my other repos as well, if you found this library userfull then you will definetly fine more in my profiles.

You may also like...

Powered by 💓

A account less backend for android

About

A simple, powerfull, and multipurpose java caching library with both memory and disk persisting ability. Save your POJO's directly in the cache

Topics

Resources

License

Stars

Watchers

Forks

Languages