Created
February 5, 2016 15:59
-
-
Save cy6erGn0m/b2d3477d2e053a41e51a to your computer and use it in GitHub Desktop.
Kotlin ehcache example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val cacheManager = CacheManagerBuilder.newCacheManagerBuilder() | |
.with(CacheManagerPersistenceConfiguration(storagePath)) | |
.withCache("kweetsCache", | |
CacheConfigurationBuilder.newCacheConfigurationBuilder<Int, Kweet>() | |
.withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() | |
.heap(1000, EntryUnit.ENTRIES) | |
.offheap(10, MemoryUnit.MB) | |
.disk(100, MemoryUnit.MB, true) | |
) | |
.buildConfig(Int::class.javaObjectType, Kweet::class.java)) | |
.build(true) |
Not necessarily Int::class.javaObjectType but your Entity's primary key.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice
Int::class.javaObjectType
that is required for ehcache to avoid the following