Officials packages
Redis
The Mineral Redis module is designed specifically for use with the Mineral framework
Use this paackage as a library
Run this command:
dart pub add mineral_redis
This will add a line like this to your package's pubspec.yaml
(and run an implicit dart pub get):
dependencies:
mineral_redis: ^1.0.0
Alternatively, your editor might support dart pub get. Check the docs for your editor to learn more.
Register the module
After installing the module, please register it within ./src/main.dart
following the scheme below The i18n module has been designed exclusively for the Mineral framework, it allows you to translate your textual content through yaml files.
Future<void> main () async {
final redis = RedisService();
Kernel kernel = Kernel(
intents: IntentService(all: true),
packages: PackageService([redis]),
await kernel.init();
}
Using our models from classes
In order to use your models, it is essential to use the Transaction
mixin.
Please note that you cannot simply import your class models directly.
import 'package:mineral_redis/mineral_redis.dart';
class MyClass with Redis 👈 {
}
Set
import 'package:mineral_mongodb/mineral_mongodb.dart';
class MyClass with Redis {
Future<void> handle (event) async {
await redis.set('key', 'value');
}
}
Get
import 'package:mineral_mongodb/mineral_mongodb.dart';
class MyClass with Redis {
Future<void> handle (event) async {
await redis.get('key');
}
}