Skip to content

Commit

Permalink
README++
Browse files Browse the repository at this point in the history
Signed-off-by: rumd3x <[email protected]>
  • Loading branch information
rumd3x committed Dec 3, 2018
1 parent 2393ab0 commit a73d94d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To install via composer just run
Create an instance of the Persistence Engine passing a string with the driver name.
Every driver is a totally different database.
If data is getting too hard to manage you should probably be using more drivers.

```php
use Rumd3x\Persistence\Engine;
$driver = 'test-db';
Expand All @@ -20,7 +21,9 @@ $db = new Engine($driver);

### Storing data
You can store an instance of any object, arrays of mixed data, strings, etc.

When you retrieve your data, you'll get back exactly what you've stored.

When your data is stored, it's being put at the bottom of a stack.
```php
$array = ['hello' => 'world', 1234, 1.666];
Expand All @@ -29,8 +32,11 @@ $db->store($array);

### Retrieving data
The engine uses FIFO.

So when you retrieve your data, you'll be retrieving from the top of the stack.
If the driver is empty it will return _null_

If the driver has nothing stored in it, it will return _null_

Also, when you retrieve your data, it will be erased from the stack, so if you are using it again, make sure to store it back.
```php
$data = $db->retrieve($array);
Expand Down

0 comments on commit a73d94d

Please sign in to comment.