-
-
Save ptupitsyn/a64c899b32b73ab55cb706cd4a09e6e9 to your computer and use it in GitHub Desktop.
Ignite.NET ICache.LocalLoadCache test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Apache.Ignite.Core; | |
using Apache.Ignite.Core.Cache.Configuration; | |
using Apache.Ignite.Core.Cache.Store; | |
using Apache.Ignite.Core.Common; | |
namespace IgniteCacheStoreTest | |
{ | |
static class Program | |
{ | |
static void Main() | |
{ | |
var ignite = Ignition.Start(); | |
var cfg = new CacheConfiguration | |
{ | |
Name = "c", | |
CacheStoreFactory = new MyStoreFactory(), | |
ReadThrough = true, | |
Backups = 1 | |
}; | |
var cache = ignite.GetOrCreateCache<int, string>(cfg); | |
cache.LocalLoadCache(null); | |
Console.WriteLine(">>> Loaded " + cache.GetSize() + " entries into cache."); | |
} | |
} | |
class MyStoreFactory : IFactory<ICacheStore> | |
{ | |
public ICacheStore CreateInstance() | |
{ | |
return new MyStore(); | |
} | |
} | |
class MyStore : CacheStoreAdapter<int, string> | |
{ | |
public override void LoadCache(Action<int, string> act, params object[] args) | |
{ | |
act(1, "Hello!"); | |
} | |
public override string Load(int key) | |
{ | |
throw new NotImplementedException(); | |
} | |
public override void Write(int key, string val) | |
{ | |
throw new NotImplementedException(); | |
} | |
public override void Delete(int key) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment