Configurable sizeOf engine for Ehcache
Simply by being on your application's classpath, ehcache-sizeofengine will automagically be picked up by Ehcache. It replaces the SizeOfEngine implementation that ships with Ehcache (2.8.0 onwards) with the EhcacheSizeOfEngine implementation of this project, which lets you control what is then being sized.
You simply need to add the jars of the modules that you want along side this project's jar
In order to ignore fields or instances of certain classes when sizing object graphs, you'll have to
public static final class StupidConfigurator implements FilterConfigurator {
@Override
public void configure(final Filter ehcacheFilter) {
// Will not size any instance of Number, and given the second arg, no subtype neither
ehcacheFilter.ignoreInstancesOf(Number.class, false);
}
}
There can be as many FilterConfigurator on the classpath as required, they'll have configure the filter once. The Filter is shared across all SizeOfEngine instances created.