[infinispan-dev] CacheContainer.getCache
Mircea Markus
mircea.markus at jboss.com
Wed Dec 1 06:13:07 EST 2010
On 1 Dec 2010, at 11:10, Manik Surtani wrote:
>
> On 1 Dec 2010, at 10:30, Galder Zamarreño wrote:
>
>>
>> On Nov 30, 2010, at 7:00 PM, Mircea Markus wrote:
>>
>>> Hi,
>>>
>>> if there is no such cache defined in the configuration with name "undefinedCacheName" and CacheContainer.getCache("undefinedCacheName") is called then an cache with default configuration and that name is first defined and then instantiated and returned.
>>> Anyone remembers what the requirement were for this is?
>>> IMO an exception should be thrown and user should be notified that the cache is not defined. This way we can fail fast e.g. If the user forgets to define a cache or misspells its name.
>>> If this behaviour is needed, an approach would be to create an specialised method to handle this: getAndDefineCache...
>>
>> I can't remember about the req, but it could make sense to differentiate between the two cases. I think someone else provided similar feedback a few months ago.
>
> We allow lazy definition of such caches via the programmatic API (e.g., for embedded caches) only. Not for remote protocols. E.g., there is no way to define and use a new cache instance via REST or Hot Rod.
>
>> I do think though that getCache should remain as is, and instead have a separate method that gets only if defined.
>
> +1.
so you want CacheContainer.getCache("notDefinednCacheName") to return a cache even if a cache with "notDefinednCacheName" was not previously defined?
>
>
> --
> Manik Surtani
> manik at jboss.org
> Lead, Infinispan
> Lead, JBoss Cache
> http://www.infinispan.org
> http://www.jbosscache.org
>
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
More information about the infinispan-dev
mailing list