Skip to content

Instantly share code, notes, and snippets.

@ptupitsyn
Created November 23, 2020 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptupitsyn/a64c899b32b73ab55cb706cd4a09e6e9 to your computer and use it in GitHub Desktop.
Save ptupitsyn/a64c899b32b73ab55cb706cd4a09e6e9 to your computer and use it in GitHub Desktop.
Ignite.NET ICache.LocalLoadCache test
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