Search in sources :

Example 21 with WritePolicy

use of com.aerospike.client.policy.WritePolicy in project XRTB by benmfaul.

the class RedissonClient method hmset.

/**
	 * Do a mhset with expire (No op on cache2k, expiry already set globally
	 * @param id String. The key name.
	 * @param m Map. The value to set.
	 * @param expire int. The number of seconds before expiry.
	 * @throws Exception on Cache2k or aerospike errors.
	 */
public void hmset(String id, Map m, int expire) throws Exception {
    if (ae == null) {
        cache.put(id, m);
        return;
    }
    WritePolicy policy = new WritePolicy();
    policy.expiration = expire;
    Key key = new Key("test", "cache", id);
    Bin bin1 = new Bin("value", m);
    ae.getClient().put(policy, key, bin1);
}
Also used : Bin(com.aerospike.client.Bin) Key(com.aerospike.client.Key) WritePolicy(com.aerospike.client.policy.WritePolicy)

Aggregations

Bin (com.aerospike.client.Bin)21 Key (com.aerospike.client.Key)21 WritePolicy (com.aerospike.client.policy.WritePolicy)21 Record (com.aerospike.client.Record)12 Test (org.junit.Test)7 AerospikeException (com.aerospike.client.AerospikeException)6 BeforeClass (org.junit.BeforeClass)3 Policy (com.aerospike.client.policy.Policy)2 AerospikeClient (com.aerospike.client.AerospikeClient)1 Value (com.aerospike.client.Value)1 ClientPolicy (com.aerospike.client.policy.ClientPolicy)1 GenerationPolicy (com.aerospike.client.policy.GenerationPolicy)1 IndexTask (com.aerospike.client.task.IndexTask)1 IOException (java.io.IOException)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1