There is an existing ehcache and lucene comparison sometime back and the answer is they can't be compared directly. However in EhCache 2.4, it now has search feature. We are thinking to migrate our currently Lucene solution into EhCache Search. One of the benefit I see is when EhCache is integrated with Terracotta, it can be become distributed cache and index easily. Any other concerns I should take account before the migration? Could anyone share their experience about EhCache Search as cache and index solution?
Thanks.
Update: After 开发者_开发技巧a quick test, it seems like EhCache Search does not allow cache to be persisted into disk. I got the below error if I try to set diskPersistent="true" on my ehcache.xml. Which mean the indexed cache need to be rebuilt everytime. I see this is one of the disadvantage.
Search attributes not supported by this store type: net.sf.ehcache.store.compound.impl.DiskPersistentStore
Here are list of limitation:
- Can't persist searchable cache into disk.
- Custom AttributeExtractor only support certain types, which means you can't use search attribute with parameterize T like net.sf.ehcache.search.Attribute.eq(T), net.sf.ehcache.search.Attribute.between(T, T) etc but only net.sf.ehcache.search.Attribute.ilike(String) which may cause slower performance and less search constraint. I have to edit the EhCache source to make it support my custom type as I wish to use Attribute.eq(T).
Thanks.
精彩评论