Icarus is an extendable Caching-Framework, designed to increase the performance of new or already existing, with just one little annotation.
Plain Java code without any frameworks:
final Map<Integer,Integer> cache = Maps.newHashMap();
int sum(final int... operands) {
final int parameterHash = Objects.hash(operands);
if(this.cache.containsKey(hash)) {
return cache.get(hash);
}
final int sum = IntStream.of(operands).sum();
this.cache.put(parameterHash, sum);
return sum;
}
By using this framework following can be done like that:
@Cached
int sum(final int... operands) {
return IntStream.of(operands).sum();
}
You want to straight jump into using Icarus? The following section will show you how to implement it in to your project correctly.
To add Icarus to your maven dependencies following code can be used:
<dependency>
<groupId>io.github.icarus</groupId>
<artifactId>icarus-core</artifactId>
<version>1.0</version>
</dependency>
When using gradle instead, following code can be used:
dependencies {
compile 'io.github.icarus:icarus-core:1.0'
}