redis_dart
a simple and minimalist redis client for dart
usage
import 'package:redis_dart/redis_dart.dart';
void main() async {
final client = await redisclient.connect('localhost');
await client.set('name', 'gabriel');
var res = await client.get('name');
print(res);
await client.close();
}
easy to use
this library was meant to be clear and easy to understand, so the methods names are associated to what the function does, like
void main() async {
final client = await redisclient.connect('localhost');
// this is a hset command
await client.setmap('info', {
'name': 'john doe',
'email': '[email protected]',
'age': 34,
});
// this one is a hgetall
var info = await client.getmap('info');
print(info);
await client.close();
}
which returns a map
and then prints
{name: john doe, email: [email protected], age: 34}
that way, inserting a redis hash is as simple as passing a dart map
.
api
for full api documentation take a look at https://pub.dev/documentation/redis_dart/latest/
also, check out the examples
directory.
Comments are closed.