repositories {
maven {
url "http://dl.bintray.com/fint/maven"
}
}
compile('no.fint:fint-cache:2.2.0')
Create and update cache:
List<TestDto> data = Lists.newArrayList(new TestDto());
FintCache<TestDto> cache = new FintCache<>();
cache.update(data);
Get values from cache:
List<TestDto> cachedList = cache.getSourceList();
Integration with Spring bean:
@Component
public class MyCacheService extends CacheService<String> {
public static final String MODEL = "test";
public TestCacheService() {
super(MODEL, MyActions.GET_ALL);
}
@PostConstruct
public void init() {
...
}
@PreDestroy
public void cleanUp() {
...
}
@Override
public void onAction(Event event) {
...
}
}
Override the onAction()
method in CacheService
to handle the events.
To add more logging, enable debug log level for FintCache.
logging.level.no.fint.cache=DEBUG