public Args() { var config = new ConfigurationBuilder() .AddJsonFile("settings.json") .Build(); string ps = config["Port"]; int port = int.Parse(config["Port"]); string user = config["User"]; string password = config["Password"]; Host[] hosts = Host.ParseHosts(config["Host"], null, port); AsyncClientPolicy policy = new AsyncClientPolicy(); policy.asyncMaxCommands = 200; if (!user.Equals("")) { policy.user = user; policy.password = password; } // Set very short expiration, so tests can verify record will expire. // Normal expiration should be much longer than this testing case. expiration = TimeSpan.FromSeconds(2); cache = new AerospikeCache(new AerospikeCacheOptions() { Hosts = hosts, ClientPolicy = policy, Namespace = config["Namespace"], Set = config["Set"] }); }
public void Close() { if (cache != null) { cache.Dispose(); cache = null; } }