Search API support

32 views
Skip to first unread message

siva CH

unread,
Jul 27, 2022, 6:39:20 AM7/27/22
to jsr107
Hi ,

Want to know Jcache has any search API's (searching in cache) or not , like ehcache2.x had some search API's(https://stackoverflow.com/questions/41586575/no-search-apis-in-ehcache-3).

Thanks,
Siva

Ondro Mihályi

unread,
Jul 27, 2022, 3:13:31 PM7/27/22
to jsr107
Hi,

No, there's no search API in JCache. It's only possible to retrieve entries using a specific key or iterate through all of them: https://javadoc.io/doc/javax.cache/cache-api/latest/index.html

So, you could either iterate through all of them and filter them one by one, which isn't very efficient.

Or you could implement and register a cache entry listener, which will update a search index and then you could search directly using this index (not using JCache API). Obviously, you would have to maintain the index yourself, e.g. using https://lucene.apache.org/ or https://www.elastic.co/elasticsearch/ That would be more efficient but also much more work. But there's nothing else you could use in the standard JCache API.

All the best,
Ondro



Dátum: streda 27. júla 2022, čas: 12:39:20 UTC+2, odosielateľ: siva CH

siva CH

unread,
Jul 31, 2022, 11:26:06 PM7/31/22
to jsr107
Thanks for reply.
If you know about ehcache3.x , Could you pls tell which is better i.e native ehcache3 and jache with ehcache3 , also in terms of performance.

Thanks,
Siva

Chris Dennis

unread,
Aug 1, 2022, 9:26:38 AM8/1/22
to jsr...@googlegroups.com

Performance wise any native access is always going to have the edge (if there is an edge to be had). You pay for that edge with some amount of vendor lock-in. No one is going to be able to answer the question of which is better without knowing *everything* about your usecase and what “better” means to you, and what potential costs vendor lock-in might have.

 

Chris

--
You received this message because you are subscribed to the Google Groups "jsr107" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsr107+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsr107/a32ebd27-7447-47b4-b5e7-0530ac5862f8n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages