Skip to content

A simple zero-dependencies non-distributed TTL in-memory cache

License

Notifications You must be signed in to change notification settings

bytemechanics/flashback-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flashback cache

Latest version Quality Gate Coverage License

A simple zero-dependencies non-distributed Time to Life in-memory cache.

Motivation

There is a lot of cache solution in market full of capabilities, therefore why another cache system? Basically to have some low-weight short-time cache for medium time consumption operations.

Quick start

(Please read our Javadoc for further information)

  1. First of all include the Jar file in your compile and execution classpath. Maven
	<dependency>
		<groupId>org.bytemechanics</groupId>
		<artifactId>flashback-cache</artifactId>
		<version>X.X.X</version>
	</dependency>

Graddle

dependencies {
    compile 'org.bytemechanics:flashback-cache:X.X.X'
}
  1. Allocate the cache service who will store all the cache values, or use the provided singleton
package mypackage;
import org.bytemechanics.cache.flashback.service.CacheServiceSingleton;
public class MyClass{
	private static final CacheServiceSingleton cacheService=CacheServiceSingleton.getInstance();
}
  1. Create a new cache
    • Infinite cache
MyObject myResolvedValue=cacheService.from("my.cache.key",() -> methodRecoverCacheValue());
  • TTL cache (will be keep the same value until the next recover after 2 minutes)
MyObject myResolvedValue=cacheService.from("my.cache.key",2l,ChronoUnit.MINUTES,() -> methodRecoverCacheValue());

About

A simple zero-dependencies non-distributed TTL in-memory cache

Resources

License

Stars

Watchers

Forks

Packages

No packages published