On 1 Dec 2010, at 11:13, Mircea Markus wrote:
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?
Yes, pls see my comment above for when this should be allowed and when it should not be
allowed.
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org