[infinispan-dev] the new CacheLoader API

Manik Surtani msurtani at redhat.com
Fri Aug 9 11:59:48 EDT 2013


On 9 Aug 2013, at 16:29, Mircea Markus <mmarkus at redhat.com> wrote:

>> 
>> My guess is Mircea was going for an overloaded method for bulkLoadKeys where we want both one that takes a Collection and one that takes a KeyFilter?  If so it seems to me it would be simpler to just have a single method that takes KeyFilter only, but then have another class like KeyFilters that has various static factory methods that can take a Iterable or Iterator for example so we don't have too many methods on the loader itself.
> 
> I think we'll end up needing both actually, as bulkLoadAll with a collection still makes sense. E.g. for JDBC queries it's easier to build a WHERE clause and select all the elements in one go.
> 
> Sanne ha a good alternative suggestion to the the bulkLoadAll:
> 
> public process(KeyFilter, j.u.c.Executor, CacheLoaderTask clt);
> 
> and 
> 
> interface CacheLoaderTask {    
>   //return false if don't need to process any longer
>   boolean process (CacheLoaderEntry cle);
> }
> 
> interface CacheLoaderEntry {
>    Object getKey();
>    ICV getInternalCacheValue();
>    //.. ongoing discussion about some other byte[] based methods
> }
> 
> 
> This would allow the CacheStore to iterate over the entries in parallel, whilst still allowing sequential iteration. Pretty awesome.

All sounds good, but may I suggest the following API (slight changes in naming, reasons in comments):

https://gist.github.com/maniksurtani/97c62352347e61d60768#file-cacheloadertask-java

--
Manik Surtani






More information about the infinispan-dev mailing list