Documentation on configuring L2 cache programatically

classic Classic list List threaded Threaded
5 messages Options
dstieglitz dstieglitz
Reply | Threaded
Open this post in threaded view
|

Documentation on configuring L2 cache programatically

Hello:

I'm interested in configuring a distributed Hibernate L2 cache programmatically as documented on this page:

http://apacheignite.gridgain.org/v1.0/docs/hibernate-l2-cache

without using the Ignition.start() method, rather, configuring the cache after the node has been started. Is this possible? Is it just a matter of configuring caches having names that match the Hibernate entity regions?

Dan
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Documentation on configuring L2 cache programatically

Hi Dan,

You can start caches dynamically after the nodes are started (just provide proper configuration to Ignite.createCache() method). But I'm not sure how you're going to live without Ignition.start(). You need an embedded node (probably client) anyway.

E.g., this scenario will work:
  - Start remote server nodes (optional).
  - Start your application and use Ignition.start() to start an embedded client.
  - Dynamically start all required caches using Ignite.createCache() method.
  - Initialize Hibernate session factory.

When starting nodes you can use configuration that doesn't have caches.

Does this work for you?
dstieglitz dstieglitz
Reply | Threaded
Open this post in threaded view
|

Re: Documentation on configuring L2 cache programatically

Let me explain the scenario a bit more: I've written a Grails plugin for Ignite (http://github.com/dstieglitz/grails-ignite). During application startup there is no application context XML file, it is created dynamically using a Groovy DSL. Additionally, each domain object cache will be created programmatically using meta programming techniques; e.g., query all domain object names, cache configuration options, and then create caches.

We will still be starting Ignite I just need to be able to create the caches via spring configuration or by running some code after the node is started to configure the caches.

Each node will be a client and remote server node to the rest of the cluster. The scenario I need is:

1. Create Ignite configuration using Groovy DSL
2. Start ignite using Ignition.start() method on each node
3. Interrogate domain class names, create CacheConfiguration objects
4. Create caches using Ignite.createCache() 
5. Initialize Hibernate session factory

What specific configuration should be provided in step 4 to ensure the caches are used for Hibernate?

Dan



On Mon, Jul 13, 2015 at 5:10 PM, vkulichenko [via Apache Ignite Users] <[hidden email]> wrote:
Hi Dan,

You can start caches dynamically after the nodes are started (just provide proper configuration to Ignite.createCache() method). But I'm not sure how you're going to live without Ignition.start(). You need an embedded node (probably client) anyway.

E.g., this scenario will work:
  - Start remote server nodes (optional).
  - Start your application and use Ignition.start() to start an embedded client.
  - Dynamically start all required caches using Ignite.createCache() method.
  - Initialize Hibernate session factory.

When starting nodes you can use configuration that doesn't have caches.

Does this work for you?


If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/Documentation-on-configuring-L2-cache-programatically-tp640p641.html
To unsubscribe from Documentation on configuring L2 cache programatically, click here.
NAML

vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Documentation on configuring L2 cache programatically

Dan,

Got it. You can use configuration from documentation, but specify it in code instead of XML. Each cache name should correspond to L2 cache region name (either a full class name or a full association name).

-Val
dstieglitz dstieglitz
Reply | Threaded
Open this post in threaded view
|

Re: Documentation on configuring L2 cache programatically

Thanks Val. One last question:

How can I get a list of programmatically created caches from the system? I've tried "ignite.configuration().cacheConfiguration" but I think that returns a set of cache configurations, not created caches? Is that correct?

Dan