-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
193 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
redis-dart | ||
|
||
A Dart library for the Redis key-value store. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,134 @@ | ||
#library("redis"); | ||
#import("dart:io"); | ||
#import("dart:utf"); | ||
#import("Connection.dart"); | ||
#import("ServerConfig.dart"); | ||
#import("../third_party/log4dart/LogLib.dart"); | ||
#source("redis_interfaces.dart"); | ||
#source("utils.dart"); | ||
interface Redis default RedisImpl { | ||
|
||
// ************ Keys Commands ************ | ||
// http://redis.io/commands#generic | ||
|
||
Future<Object> Del(key); | ||
|
||
Future<Object> Dump(key); | ||
|
||
Future<Object> Exists(key); | ||
|
||
Future<Object> Expire(key, seconds); | ||
|
||
Future<Object> Expireat(key, timestamp); | ||
|
||
Future<Object> Keys(pattern); | ||
|
||
Future<Object> Migrate(host, port, key, destination_db, timeout); | ||
|
||
Future<Object> Move(key, db); | ||
|
||
Future<Object> ObjectCmd(subcommand, [arguments]); | ||
|
||
Future<Object> Persist(key); | ||
|
||
Future<Object> Pexpire(key, milliseconds); | ||
|
||
Future<Object> Pexpireat(key, milliseconds_timestamp); | ||
|
||
Future<Object> Pttl(key); | ||
|
||
Future<Object> RandomKey(); | ||
|
||
Future<Object> Rename(key, newkey); | ||
|
||
Future<Object> Renamenx(key, newkey); | ||
|
||
Future<Object> Restore(key, ttl, serialized_value); | ||
|
||
Future<Object> Sort(key); | ||
|
||
Future<Object> TTL(key); | ||
|
||
Future<Object> Type(key); | ||
|
||
|
||
// ************ String commands ************ | ||
// http://redis.io/commands#string | ||
|
||
/** | ||
* Append a value to a key | ||
* http://redis.io/commands/append | ||
*/ | ||
Future<Object> Append(String key, String value); | ||
|
||
/** | ||
* Decrement the integer value of a key by one | ||
* http://redis.io/commands/decr | ||
*/ | ||
Future<Object> Decr(String key); | ||
|
||
/** | ||
* Get the value of a key | ||
* http://redis.io/commands/get | ||
*/ | ||
Future<Object> Get(String key); | ||
|
||
/** | ||
* Set the string value of a key | ||
* http://redis.io/commands/set | ||
*/ | ||
Future<Object> Set(String key, String value); | ||
|
||
|
||
// ************ Connections Commands ************ | ||
// http://redis.io/commands#connection | ||
|
||
Auth(password); | ||
|
||
Echo(message); | ||
|
||
Ping(); | ||
|
||
Quit(); | ||
|
||
Select(num index); | ||
|
||
|
||
// ************ Server Commands ************ | ||
// http://redis.io/commands#server | ||
|
||
Future<Object> Bgrewriteaof(); | ||
|
||
Future<Object> BackgroundSave(); | ||
|
||
Future<Object> ConfigGet(parameter); | ||
|
||
Future<Object> ConfigSet(parameter, value); | ||
|
||
Future<Object> ConfigResetstat(); | ||
|
||
Future<Object> DbSize(); | ||
|
||
Future<Object> DebugObject(key); | ||
|
||
Future<Object> DebugSegfault(); | ||
|
||
Future<Object> FlushAll(); | ||
|
||
Future<Object> FlushDb(); | ||
|
||
Future<Object> Info(); | ||
|
||
Future<Object> LastSave(); | ||
|
||
Future<Object> Monitor(); | ||
|
||
Future<Object> Save(); | ||
|
||
Future<Object> Shutdown(); | ||
|
||
Future<Object> ShutdownSave(); | ||
|
||
Future<Object> ShutdownNoSave(); | ||
|
||
Future<Object> SlaveOf(host, port); | ||
|
||
Future<Object> SlowLog(subcommand, [argument]); | ||
|
||
Future<Object> Sync(); | ||
|
||
Future<Object> Time(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
#library("ServerConfig"); | ||
|
||
class ServerConfig{ | ||
class ServerConfig { | ||
String host; | ||
int port; | ||
int db; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#library("redis_tests"); | ||
|
||
#import("../lib/redis.dart"); | ||
#import("dart:io"); | ||
#import('dart:builtin'); | ||
#import('../third_party/testing/unittest/unittest_vm.dart'); | ||
|
||
void testSet(Redis client) { | ||
client.set("key1", "value1"); | ||
Expect.equals("value1", client.get("key1")); | ||
|
||
Future f = conn.connect(); | ||
f.then((connected) { | ||
Expect.equals(false, connected); | ||
}); | ||
|
||
f.handleException((o) { | ||
callbackDone(); | ||
//conn.close(); | ||
return true; | ||
}); | ||
} | ||
|
||
void testGet() { | ||
|
||
} | ||
|
||
void main() { | ||
Utils.setVerboseState(); | ||
group("Connection tests:", () { | ||
asyncTest("Test get value", 1, testGet); | ||
asyncTest("Test set value", 1, testSet); | ||
// asyncTest("Test socket failed connection",1, connectionFailTest); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.