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?
When I hover over the method LoadCache(Action<int, Associate>, params object args) in Visual Studio, it says that "...This method is called whenever Apache.Ignite.Core.Cache.ICache<TK,TV>.LocalLoadCache(Apache.Ignite.Core.Cache.ICacheEntryFilter<TK,TV>, params object) method is invoked which is usually to preload the cache from persistent storage".
From the .NET docs, it says that for LocalLoadCache(ICacheEntryFilter<TK, TV>, Object), the loaded values will then be given to the optionally passed in predicate, and, if the predicate returns true, will be stored in cache. If predicate is null, then all loaded values will be stored in cache.
In my case, I call cache.LocalLoadCache(null) in Program.cs, where it then calls on LoadCache(Action<int, Associate> act, params object args) in OracleStore.cs and the Associate IDs are being printed to console.
However, when I try to print the cache size in console, it returns 0 - does this mean that the values are not being stored in cache?
Do I need to do something else to make sure the values are loaded into cache? I thought that LocalLoadCache would just put all the values queried from the underlying storage into cache.
2. I added something to my LoadCache(Action<int, Associate>, params object args) method in OracleStore.cs. I added the following 3 lines after the while loop:
Console returned a non-zero cache size of 5136, however, the queries I wanted to do and the queries counted by the method is 10,000 - I was wondering what happened to the other ~5000 queries and why they aren't in cache?
I'll try a local scenario and stream with fake data right now, but how would I check to see if the underlying database is a bottleneck?
Sent from the Apache Ignite Users mailing list archive at Nabble.com.