Skip to content

Commit 40099c1

Browse files
committed
📝 updated readme
1 parent 42fe50c commit 40099c1

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ composer require leafs/redis
2828

2929
To get started with Leaf Redis, you simply need to call the `init` method and pass in any configuration you need.
3030

31+
```php
32+
Leaf\Redis::init();
33+
```
34+
35+
This will initialize a new redis connection, from there, you can call any function you need to call.
36+
3137
### Aloe CLI
3238

3339
Although Leaf Redis can be used outside the Leaf environment, there's more support for Leaf based frameworks. Leaf Redis comes with out of the box support for Aloe CLI which is used in Leaf MVC and Leaf API. To get started, head over to the `leaf` file in the root directory of your Leaf API/Leaf MVC app or wherever aloe CLI is registered and register a new command.
@@ -40,7 +46,44 @@ From there you should have access to a bunch of new commands from Leaf redis. Th
4046

4147
```sh
4248
redis
43-
redis:install Create leaf redis config and .env variables
49+
redis:install Create leaf redis config and .env variables
50+
redis:server Start redis server
51+
```
52+
53+
## Available Methods
54+
55+
### set
56+
57+
This allows you to set a redis entry.
58+
59+
```php
60+
Leaf\Redis::set("key", "value");
61+
62+
// you can also use arrays to set multiple values at once
63+
64+
Leaf\Redis::set(["key" => "value", "key2" => "value"]);
65+
```
66+
67+
### get
68+
69+
This returns a saved redis entry.
70+
71+
```php
72+
$value = Leaf\Redis::get("key");
73+
74+
// You can also get multiple entries at once
75+
76+
$data = Leaf\Redis::get(["key", "key2"]);
77+
78+
// $data => [key => value, key2 => value]
79+
```
80+
81+
### ping
82+
83+
Ping the redis server
84+
85+
```php
86+
Leaf\Redis::ping();
4487
```
4588

4689
## View Leaf's docs [here](https://leafphp.netlify.app/#/)

0 commit comments

Comments
 (0)