Hello, *> (1)* Regarding the Load method, I was under the impression that calling Get(key) would inherently call the Load(key) method from my OracleStore.cs
It would if you set CacheConfiguration.ReadThrough = true. Similarly, enable WriteThrough if you want Ignite to call OracleStore.Write on cache.Put. > *(2)* With the LoadCache method, I essentially would be doing the same thing as the Load method, but this time, I would be querying 10,000 entries from the database and putting it into cache > am unsure about what to do for the Action<TK, TV> parameter You are supposed to call this action for every entry to be loaded into cache, e.g.: while(reader.Read()) { /* * 1) Instantiate Associate object * 2) Put Associate object in cache */ var associate = new Associate(reader); act(associate.Id, associate); } On Fri, Nov 20, 2020 at 8:23 PM ABDumalagan <ad1...@scarletmail.rutgers.edu> wrote: > Hello, > > I have some confusion about implementing my own Load and LoadCache methods > - > > I am trying to load data from an underlying Oracle database into cache, > and the entries are key-value pairs where the key is the Associate ID and > the value is the entire Associate object. > > *(1)* Regarding the Load method, I was under the impression that calling > Get(key) would inherently call the Load(key) method from my OracleStore.cs > file and load the key and corresponding object from the database into > cache. > > Under the Load method in OracleStore.cs, I connect to the underlying > Oracle database and execute a query which grabs the data that correlates to > the Associate ID. > > However, after running my Program.cs file, I received an error saying > *"System.Collections.Generic.KeyNotFoundException: > 'The given key was not present in the cache: 18755"* -- was I under the > wrong impression that the Load(key) would just put the data into cache? > > I know that the Load method returns an object, and in my case, it returns > an Associate object. However, do I need to do implement something else in > order to put the object returned from the Load method into cache? > > *(2)* With the LoadCache method, I essentially would be doing the same > thing as the Load method, but this time, I would be querying 10,000 entries > from the database and putting it into cache. I also hold the same > assumption that calling the LoadCache method will just load the 10,000 > entries in cache. > > Also, I am unsure about what to do for the Action<TK, TV> parameter in > LoadCache(Action<TK, TV>, Object[])--would I need to define a method to > pass as a parameter, and would that method be responsible for putting the > entries in cache? If so, how would I go about it? > > Files attached below: > > Inherits CacheStoreAdapter: OracleStore.cs > <http://apache-ignite-users.70518.x6.nabble.com/file/t3023/OracleStore.cs> > > Inherits IFactory: OracleStoreFactory.cs > <http://apache-ignite-users.70518.x6.nabble.com/file/t3023/OracleStoreFactory.cs> > > Establishes Oracle database connection: DBConnection.cs > <http://apache-ignite-users.70518.x6.nabble.com/file/t3023/DBConnection.cs> > > Defines Associate object: Associate.cs > <http://apache-ignite-users.70518.x6.nabble.com/file/t3023/Associate.cs> > > Runs program (creates and starts node): Program.cs > <http://apache-ignite-users.70518.x6.nabble.com/file/t3023/Program.cs> > > ------------------------------ > Sent from the Apache Ignite Users mailing list archive > <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com. > >