This is exactly what the BootstrapCacheLoader
will do for you.
Have a look at the following documentation entry.
It seems this is fully integrated in the Spring Ehcache bridge - see here
In short the steps to get there are:
- Determine how you will know what needs to be loaded at startup - that is your set of keys
- Implement your own
BootstrapCacheLoader
that will use the set to load eagerly all entries, async or sync at cache initialisation time.
- Wire it using a
BootstrapCacheLoaderFactory
through XML (Ehcache) or even directly (Spring)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…