[ 
https://issues.apache.org/jira/browse/IGNITE-11141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16761661#comment-16761661
 ] 

Stanislav Lukyanov commented on IGNITE-11141:
---------------------------------------------

[~smoldachev] Yep, I imagine it would be kind of like that + edge case handling 
(cache not exists, etc) + defensive copying (I assume this method would be used 
for getting a template, modifying it and starting a new cache, so we should be 
able to safely mutate the returned config) + synchronization ceremony (see 
guard() and other calls in other API methods).

Also, this would be a part of the very core API, so I would ask on the dev-list 
if anyone has any objections.

> Add Java method to create a cache from a template
> -------------------------------------------------
>
>                 Key: IGNITE-11141
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11141
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Stanislav Lukyanov
>            Assignee: Moldachev Sergey
>            Priority: Major
>              Labels: newbie
>
> Currently cache templates can only be used via REST or SQL: 
> https://apacheignite.readme.io/docs/cache-template.
> It seems reasonable to add the same functionality to Java.
> The most flexible way would probably be to add a method like 
> `cacheConfiguration(String)` that would return a configuration of a template 
> with the given name. Then to create a cache from a template one would write 
> code like this
> {code}
> CacheConfiguration cfg = ignite.cacheConfiguration("myTemplate");
> cfg.setName("myCacheFromTemplate");
> ignite.createCache(cfg);
> {code}
> As a bonus, the `cacheConfiguration(String)` method may work with regular 
> caches too. For them it would be a shortcut for 
> `ignite.cache("myCache").getConfiguration()`.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to