private static void CheckKeyExists(AerospikeClient client, Policy policy,
         Key key)
 {
     Console.WriteLine("Check a record exists");
     var exists = client.Exists(policy, key);
     Console.WriteLine(key + " exists? " + exists);
     Console.WriteLine("");
 }
Exemplo n.º 2
0
        /// <summary>
        /// Check existence of records in one batch.
        /// </summary>
        private void BatchExists(AerospikeClient client, Arguments args, string keyPrefix, int size)
        {
            // Batch into one call.
            Key[] keys = new Key[size];
            for (int i = 0; i < size; i++)
            {
                keys[i] = new Key(args.ns, args.set, keyPrefix + (i + 1));
            }

            bool[] existsArray = client.Exists(null, keys);

            for (int i = 0; i < existsArray.Length; i++)
            {
                Key key = keys[i];
                bool exists = existsArray[i];
                console.Info("Record: namespace={0} set={1} key={2} exists={3}",
                    key.ns, key.setName, key.userKey, exists);
            }
        }