Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kernel0x/falcon
📦 Thread-safe, crypto-protected, multi-level lru caching with a life cycle
https://github.com/kernel0x/falcon
android android-library cache cachemanager lru lru-cache lrucache
Last synced: about 1 month ago
JSON representation
📦 Thread-safe, crypto-protected, multi-level lru caching with a life cycle
- Host: GitHub
- URL: https://github.com/kernel0x/falcon
- Owner: kernel0x
- Created: 2019-11-15T10:55:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-24T08:29:41.000Z (over 1 year ago)
- Last Synced: 2024-10-20T10:17:29.542Z (3 months ago)
- Topics: android, android-library, cache, cachemanager, lru, lru-cache, lrucache
- Language: Kotlin
- Homepage:
- Size: 175 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
````java
allprojects {
repositories {
...
maven { url "https://jitpack.io"}
}
}
````Add the dependency:
````java
dependencies {
implementation 'com.github.kernel0x:falcon:1.0.2'
}
````## How to use
Create an object using the builder.
````java
Cache cache = new Cache.Builder().build(getContext());
````
OR with special type````java
Cache cache = new Cache.Builder().build(getContext());
````
Available methods in the Builder- **defaultLifetime** *default cache lifetime*
- **maxSize** *maximum cache size (file and ram)*
- **caseSensitiveKeys** *key case sensitivity*
- **autoCleanup** *auto clean timer time*
- **dualCacheMode** *caching mode*
- **encryptStrategy** *encryption algorithm*Everything is simple. Now you can cache something.
Important! Cached objects must implement Serializable### Examples:
````java
cache.set(KEY, new Cat());
````
````java
cache.set(KEY, new Cat(), DualCacheMode.ONLY_DISK);
````
````java
cache.set(KEY, new Cat(), DualCacheMode.ONLY_RAM);
````
````java
cache.set(KEY, new Cat(), new Duration(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!](/app/src/test/java/com/kernel/falcon) :wink:## Releases
Checkout the [Releases](https://github.com/kernel0x/falcon/releases) tab for all release info.