https://github.com/palexdev/imcache
A small and simple library for downloading and caching images
https://github.com/palexdev/imcache
Last synced: 1 day ago
JSON representation
A small and simple library for downloading and caching images
- Host: GitHub
- URL: https://github.com/palexdev/imcache
- Owner: palexdev
- License: lgpl-3.0
- Created: 2024-08-12T11:06:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-10-16T10:26:54.000Z (8 months ago)
- Last Synced: 2026-06-08T09:02:50.328Z (10 days ago)
- Language: Java
- Size: 222 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[//]: @formatter:off
# ImCache
**ImCache** is a lightweight Java library for fetching and caching images from any URL (whether it's a local
file, a web resource, or a custom protocol). It supports in-memory and on-disk caching strategies, as well as optional
image transformations prior to caching.
---
## ⨠Features
- đ Fetch images from local or remote URLs
- đ§ `MemoryCache`: fast in-memory caching with optional disk sync
- đž `DiskCache`: persistent storage for long-term caching
- âģī¸ Auto-eviction based on capacity (default: 100 items)
- đŧī¸ Supports custom image transformations
---
## đĻ Installation
### Gradle
```groovy
dependencies {
implementation 'io.github.palexdev:imcache:21.4.0'
}
```
### Maven
```xml
io.github.palexdev
imcache
21.4.0
```
## đ Getting Started
Here's a generic quick example of how to use ImCache:
```java
ImCache.instance() // You can also create new instances, constructor is public
.cacheConfig(() ->{/*Cache configuration*/})
.storeStrategy(...) // Cache original or transformed image
.request(myResource) // Can be a URL, file, string...
.transform(...) // Here you can specify what transform to apply to the image
.execute(callback); // Or executeAsync(...) if you want to load in the background. The callback is optional!
```
## đ Documentation
You can read the documentation [here](https://javadoc.io/doc/io.github.palexdev/imcache).
## ÂŠī¸ License
Distributed under the GNU LGPLv3 License. See LICENSE for more information.