A cache structure that supports expiration on a per-key basis.
All of the jar packages has been uploaded to the maven central.
Use memory cahce only:
dependencies {
compile "com.labijie:labijie-caching:1.0"
}
for redis:
dependencies {
compile "com.labijie:labijie-caching-redis:1.0"
}
You only need to use the ICacheManager interface, which can be easily integrated into the IOC container, such as spring. use
ICacheManager memoryCache = new MemoryCacheManager(new MemoryCacheOptions());
//sliding time expires
memoryCache.set("2", new Object(), 3000L, true);
//absolute time expires
memoryCache.set("a", new Object(), 1000L, false);
//get
memoryCache.get("a")
use SingleRedisCacheManager for redis support
gradle uploadArchives
modify build.gradle and put your maven server (such as nexus server):
for example , you server is 'https://nexus-server/', user name is [my], password is [mypwd]
- modify build.gradle:
mavenDeployer {
pom.project {
artifactId "labijie-caching" + (project.name == "core" ? "" : "-" + project.name)
version project.rootProject.version
}
snapshotRepository(url: "https://nexus-server/") {
authentication(userName: u, password: p)
}
repository(url: "https://nexus-server/") {
authentication(userName: u, password: p)
}
}
- run command in terminal
gradle -Dmu="my" -Dmp="mypwd" uploadArchives