[infinispan-dev] [ISPN-32] API changes for query module
Emmanuel Bernard
emmanuel at hibernate.org
Thu Jul 2 04:15:02 EDT 2009
On Jul 1, 2009, at 10:05, Galder Zamarreno wrote:
>>
>> 3 - SearchableCache: -
>>
>> Should the name of this class be changed? I don't think so but if
>> anyone
>> has any ideas ...
>
> Here's my point of view:
>
> createQuery() looks to me like factory method and so I think it
> would suit more a factory interface, i.e. QueryFactory? rather than
> in an extension of Cache.
>
> IMO, extending Cache interface would make sense if you're gonna add
> an operation against the searchable or queryable cache itself, such
> query(). But this method kind of implies that you actually execute
> the query against the cache, so you'd imagine taking a CacheQuery as
> parameter. Bearing in mind my limited knowledge of how users use JBC
> Searchable, I dunno if having such method makes sense or not. If it
> does not, not a problem. Stick with a QueryFactory interface that
> has a create() method that returns Query (or CacheQuery) and that's
> it.
>
Well except that your API will be just verbose and complex to use.
What's better?
List<Item> results = cache.createQuery(luceneQuery,
Item.class).setMaxResults(20).getResultList();
or
Query q =
cache.getCacheManager().getQueryFactory().create(luceneQuery,
Item.class)..setMaxResults(20);
List<Item> results = cache.query(q);
in other words, who cares if it's a factory, a factory factory or an
abstract factory factory factory. People just want to create a query
and get the result list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20090702/6997f818/attachment-0001.html
More information about the infinispan-dev
mailing list