Example #1
0
        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("");
        }
        /// <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);
            }
        }
Example #3
0
        public static void BatchExists(AerospikeClient client)
        {
            Key[] keys = new Key[size];
            for (int i = 0; i < size; i++)
            {
                keys[i] = new Key("test", "Write", keyPrefix + (i + 1));
            }

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

            for (int i = 0; i < existsArray.Length; i++)
            {
                if (!existsArray[i])
                {
                    Console.WriteLine("Some batch records not found.");
                }
            }
        }
 private void exists()
 {
     // C# Exists Example
     Key  userKey         = new Key("test", "users", "user1234");
     bool recordKeyExists = client.Exists(null, userKey);
 }
Example #5
0
        /// <summary>
        /// Does key value exist?
        /// </summary>
        /// <param name="keyValue">key value to lookup</param>
        public bool Exists(Value keyValue)
        {
            Key subKey = MakeSubKey(keyValue);

            return(client.Exists(this.policy, subKey));
        }