You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by matt <go...@gmail.com> on 2017/11/30 22:30:42 UTC

How to provide a dependency to a custom CacheStoreAdapter

I've created a custom CacheStoreAdapter which requires a dependency. I am now
just instantiating directly in this class, but for each cache, this
dependency is re-created, which is not what I want. Is there a way I can
have this dependency instance, provided to the my adapter?

Thanks
- Matt



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How to provide a dependency to a custom CacheStoreAdapter

Posted by "ilya.kasnacheev" <il...@gmail.com>.
Hello Matt!

I imagine you can have a custom CacheStore factory (implementing
Factory<CacheStore&lt;K, V>>) that will create (or otherwise obtain) the
dependency, and then supply it to every subsequent CacheStoreAdapter it
creates.

Then you will pass the same CacheStoreFactory in configuration of each cache
that you create, via setCacheStoreFactory().

You can also inject some useful things into CacheStore, such as Ignite
instance via @IgniteInstanceResource annotation and CacheStoreSession via
@CacheStoreSessionResource.

Hope this helps,



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/