v0.1.0
Loading...
Searching...
No Matches
me.ccute.kvstore.sdk.client.NettyKvClient Class Reference
Inheritance diagram for me.ccute.kvstore.sdk.client.NettyKvClient:
Collaboration diagram for me.ccute.kvstore.sdk.client.NettyKvClient:

Public Member Functions

void set (String key, String value)
 
String get (String key)
 
boolean delete (String key)
 
void increment (String key, int incrementAmount)
 
void increment (String key)
 
java.util.concurrent.CompletableFuture< String > executeAsync (String command, String... args)
 
String execute (String command, String... args)
 
void close ()
 

Package Functions

 NettyKvClient (String host, int port, int timeoutMs)
 

Member Function Documentation

◆ delete()

boolean me.ccute.kvstore.sdk.client.NettyKvClient.delete ( String key)

Deletes the given key and its associated value from the database.

Parameters
keyThe unique identifier for the data. Cannot be null or empty.
Returns
true if the key was deleted, false if it did not exist.
Exceptions
KvExceptionif a network or server error occurs.

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ execute()

String me.ccute.kvstore.sdk.client.NettyKvClient.execute ( String command,
String... args )

Executes a raw command against the server. Useful for CLI tools or invoking custom server commands not yet typed in the SDK.

Parameters
commandThe command to execute (e.g., "SET").
argsThe arguments for the command.
Returns
The string response from the server.
Exceptions
KvExceptionif the command fails or times out.

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ executeAsync()

java.util.concurrent.CompletableFuture< String > me.ccute.kvstore.sdk.client.NettyKvClient.executeAsync ( String command,
String... args )

Executes a command asynchronously, returning a Future. Perfect for high-throughput pipelining.

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ get()

String me.ccute.kvstore.sdk.client.NettyKvClient.get ( String key)

Retrieves the value associated with the given key.

Parameters
keyThe unique identifier for the data. Cannot be null or empty.
Returns
The value, or null if the key does not exist.
Exceptions
KvExceptionif a network or server error occurs.

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ increment() [1/2]

void me.ccute.kvstore.sdk.client.NettyKvClient.increment ( String key)

Increments the numeric value stored at the specified key by exactly 1.

This is a convenience method equivalent to calling increment(key, 1).

Parameters
keyThe unique identifier for the data. Cannot be null or empty.
See also
#increment(String, int)

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ increment() [2/2]

void me.ccute.kvstore.sdk.client.NettyKvClient.increment ( String key,
int increment )

Increments the numeric value stored at the specified key by the given amount.

If the key does not exist, it is initialized to 0 before performing the increment. If the stored value cannot be parsed as an integer, a KvException is thrown.

Parameters
keyThe unique identifier for the data. Cannot be null or empty.
incrementThe amount to add to the current value. Can be negative to decrement.
Exceptions
IllegalArgumentExceptionif the key is invalid.
KvExceptionif a network error occurs or the existing value is not a number.

Implements me.ccute.kvstore.sdk.client.KvClient.

◆ set()

void me.ccute.kvstore.sdk.client.NettyKvClient.set ( String key,
String value )

Stores a value in the database associated with the given key.

Parameters
keyThe unique identifier for the data. Cannot be null or empty.
valueThe string value to store. Cannot be null.
Exceptions
IllegalArgumentExceptionif the key or value is invalid.
KvExceptionif a network or server error occurs.

Implements me.ccute.kvstore.sdk.client.KvClient.


The documentation for this class was generated from the following file: