Skip to content

Repository files navigation

Falcon

A lightweight and simple library to cache any serializable objects, using the LRU algorithm, two storage levels (files, memory), encryption and life cycle.

Gradle Dependency

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

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

Add the dependency:

dependencies {
implementation'com.github.kernel0x:falcon:1.0.2'
}

How to use

Create an object using the builder.

Cache<Object> cache = newCache.Builder().build(getContext());

OR with special type

Cache<Cat> cache = newCache.Builder().build(getContext());

Available methods in the Builder

  • defaultLifetimedefault cache lifetime
  • maxSizemaximum cache size (file and ram)
  • caseSensitiveKeyskey case sensitivity
  • autoCleanupauto clean timer time
  • dualCacheModecaching mode
  • encryptStrategyencryption algorithm

Everything is simple. Now you can cache something. Important! Cached objects must implement Serializable

Examples:

cache.set(KEY, newCat());
cache.set(KEY, newCat(), DualCacheMode.ONLY_DISK);
cache.set(KEY, newCat(), DualCacheMode.ONLY_RAM);
cache.set(KEY, newCat(), newDuration(1, TimeUnit.SECONDS));

Features

  • encryption
  • cache location selection (file or memory)
  • LRU, cache extrusion method
  • cache lifetime selection
  • thread safe

Tests

It's totally tested. Check the tests! 😉

Releases

Checkout the Releases tab for all release info.

About

📦 Thread-safe, crypto-protected, multi-level lru caching with a life cycle

Topics

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages