https://github.com/scacap/fifocache
A first-in first-out file cache that uses your app's internal cache directory
https://github.com/scacap/fifocache
Last synced: 11 months ago
JSON representation
A first-in first-out file cache that uses your app's internal cache directory
- Host: GitHub
- URL: https://github.com/scacap/fifocache
- Owner: ScaCap
- License: apache-2.0
- Created: 2018-02-11T23:56:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-06T07:55:24.000Z (over 2 years ago)
- Last Synced: 2025-01-13T09:38:09.588Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 146 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# FIFOCache
A first-in first-out file cache that uses your app's internal cache directory. More details [here](https://engineering.scalable.capital/2018/02/20/fifocache-a-self-managing-cache-for-android.html).
## Usage
```
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
FIFOCache cache = new FIFOCache(this);
InputStream inputStream = getAssets().open("sample.pdf");
long size = getAssets().openFd("sample.pdf").getLength();
cache.cache(inputStream, "sample", size);
//...
File cachedFile = cache.retrieve("sample");
}
}
```
## Installation
``` groovy
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation "com.github.ScaCap:FIFOCache:1.0.0"
}
```
## License
FIFOCache is Open Source software released under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html).