org.infinispan.client.hotrod.impl
Class HotrodOperationsImpl

java.lang.Object
  extended by org.infinispan.client.hotrod.impl.HotrodOperationsImpl
All Implemented Interfaces:
HotrodConstants, HotrodOperations

public class HotrodOperationsImpl
extends Object
implements HotrodOperations, HotrodConstants

// TODO: Document this

Since:
4.1
Author:
mmarkus

Field Summary
 
Fields inherited from interface org.infinispan.client.hotrod.impl.HotrodConstants
CLEAR_REQUEST, CLEAR_RESPONSE, CLIENT_INTELLIGENCE_BASIC, CLIENT_INTELLIGENCE_HASH_DISTRIBUTION_AWARE, CLIENT_INTELLIGENCE_TOPOLOGY_AWARE, COMMAND_TIMEOUT_STATUS, CONTAINS_KEY_REQUEST, CONTAINS_KEY_RESPONSE, ERROR_RESPONSE, GET_REQUEST, GET_RESPONSE, GET_WITH_VERSION, GET_WITH_VERSION_RESPONSE, HOTROD_VERSION, INVALID_MAGIC_OR_MESSAGE_ID_STATUS, KEY_DOES_NOT_EXIST_STATUS, NO_ERROR_STATUS, NOT_PUT_REMOVED_REPLACED_STATUS, PING_REQUEST, PING_RESPONSE, PUT_IF_ABSENT_REQUEST, PUT_IF_ABSENT_RESPONSE, PUT_REQUEST, PUT_RESPONSE, REMOVE_IF_UNMODIFIED_REQUEST, REMOVE_IF_UNMODIFIED_RESPONSE, REMOVE_REQUEST, REMOVE_RESPONSE, REPLACE_IF_UNMODIFIED_REQUEST, REPLACE_IF_UNMODIFIED_RESPONSE, REPLACE_REQUEST, REPLACE_RESPONSE, REQUEST_MAGIC, REQUEST_PARSING_ERROR_STATUS, RESPONSE_MAGIC, SERVER_ERROR_STATUS, STATS_REQUEST, STATS_RESPONSE, UNKNOWN_COMMAND_STATUS, UNKNOWN_VERSION_STATUS
 
Constructor Summary
HotrodOperationsImpl(String cacheName, TransportFactory transportFactory)
           
 
Method Summary
 void clear(Flag... flags)
           
 boolean containsKey(byte[] key, Flag... flags)
           
 byte[] get(byte[] key, Flag[] flags)
           
 BinaryVersionedValue getWithVersion(byte[] key, Flag... flags)
          Returns null if the given key does not exist.
 boolean ping()
           
 byte[] put(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags)
           
 byte[] putIfAbsent(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags)
           
 byte[] remove(byte[] key, Flag[] flags)
           
 VersionedOperationResponse removeIfUnmodified(byte[] key, long version, Flag... flags)
          Request: [header][key length][key][entry_version]
 byte[] replace(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags)
           
 VersionedOperationResponse replaceIfUnmodified(byte[] key, byte[] value, int lifespan, int maxIdle, long version, Flag... flags)
          request : [header][key length][key][lifespan][max idle][entry_version][value length][value] response: If ForceReturnPreviousValue has been passed, this responses will contain previous [value length][value] for that key.
 Map<String,String> stats()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HotrodOperationsImpl

public HotrodOperationsImpl(String cacheName,
                            TransportFactory transportFactory)
Method Detail

get

public byte[] get(byte[] key,
                  Flag[] flags)
Specified by:
get in interface HotrodOperations

remove

public byte[] remove(byte[] key,
                     Flag[] flags)
Specified by:
remove in interface HotrodOperations

containsKey

public boolean containsKey(byte[] key,
                           Flag... flags)
Specified by:
containsKey in interface HotrodOperations

getWithVersion

public BinaryVersionedValue getWithVersion(byte[] key,
                                           Flag... flags)
Description copied from interface: HotrodOperations
Returns null if the given key does not exist.

Specified by:
getWithVersion in interface HotrodOperations

put

public byte[] put(byte[] key,
                  byte[] value,
                  int lifespan,
                  int maxIdle,
                  Flag... flags)
Specified by:
put in interface HotrodOperations
lifespan - number of seconds that a entry during which the entry is allowed to life. If number of seconds is bigger than 30 days, this number of seconds is treated as UNIX time and so, represents the number of seconds since 1/1/1970. If set to 0, lifespan is unlimited.
maxIdle - Number of seconds that a entry can be idle before it's evicted from the cache. If 0, no max

putIfAbsent

public byte[] putIfAbsent(byte[] key,
                          byte[] value,
                          int lifespan,
                          int maxIdle,
                          Flag... flags)
Specified by:
putIfAbsent in interface HotrodOperations
lifespan - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)
maxIdle - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)

replace

public byte[] replace(byte[] key,
                      byte[] value,
                      int lifespan,
                      int maxIdle,
                      Flag... flags)
Specified by:
replace in interface HotrodOperations
lifespan - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)
maxIdle - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)

replaceIfUnmodified

public VersionedOperationResponse replaceIfUnmodified(byte[] key,
                                                      byte[] value,
                                                      int lifespan,
                                                      int maxIdle,
                                                      long version,
                                                      Flag... flags)
request : [header][key length][key][lifespan][max idle][entry_version][value length][value] response: If ForceReturnPreviousValue has been passed, this responses will contain previous [value length][value] for that key. If the key does not exist or previous was null, value length would be 0. Otherwise, if no ForceReturnPreviousValue was sent, the response would be empty.

Specified by:
replaceIfUnmodified in interface HotrodOperations
lifespan - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)
maxIdle - same as in HotrodOperations.put(byte[],byte[],int,int,org.infinispan.client.hotrod.Flag...)

removeIfUnmodified

public VersionedOperationResponse removeIfUnmodified(byte[] key,
                                                     long version,
                                                     Flag... flags)
Request: [header][key length][key][entry_version]

Specified by:
removeIfUnmodified in interface HotrodOperations

clear

public void clear(Flag... flags)
Specified by:
clear in interface HotrodOperations

stats

public Map<String,String> stats()
Specified by:
stats in interface HotrodOperations

ping

public boolean ping()
Specified by:
ping in interface HotrodOperations

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.