Files
shorebird/packages/redis_client

🐦 Shorebird Redis Client

pub package ci codecov License: MIT

A Dart library for interacting with a Redis server.

Built with 💙 by Shorebird.

Quick Start 🚀

import 'package:shorebird_redis_client/shorebird_redis_client.dart';

Future<void> main() async {
  // Create an instance of a RedisClient.
  final client = RedisClient();

  // Connect to the Redis server.
  await client.connect();

  // Set the value of a key.
  await client.set(key: 'HELLO', value: 'WORLD');

  // Get the value of a key.
  final value = await client.get(key: 'HELLO'); // WORLD

  // Delete the key.
  await client.delete(key: 'HELLO');

  // Close the connection to the Redis server.
  await client.close();
}

Testing 🧪

To run the tests locally, ensure you have Docker installed and pull the redis-stack-server image:

docker pull redis/redis-stack-server

Then, start the server:

docker run -p 6379:6379 --rm -e REDIS_ARGS="--requirepass password" redis/redis-stack-server

Now you can run the tests locally:

dart test

License 📃

Shorebird packages are licensed for use under either Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.

See our license philosophy for more information on why we license files this way: https://github.com/shorebirdtech/handbook/blob/main/engineering.md#licensing-philosophy