Skip to content

Commit 51fe10b

Browse files
author
Reza Shadman
committed
Update docs.
1 parent 5c3ff0b commit 51fe10b

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
1-
# eloquent-faster
2-
Simply none-I/O cache for eloquent model mutator and accessor config.
1+
# Eloquent Faster
2+
Simple none-I/O cache for eloquent model accessor and mutators.
3+
4+
### Installation
5+
6+
```php
7+
composer require "reshadman/faster-eloquent"
8+
```
9+
### Usage
10+
11+
First you need to add the following service provider to your application
12+
13+
```php
14+
return [
15+
//.. other config
16+
17+
'providers' => [
18+
// other providers
19+
\Reshadman\EloquentFaster\EloquentFasterServiceProvider::class
20+
]
21+
22+
];
23+
```
24+
25+
Then run the following artisan command
26+
```
27+
php artisan eloquent:cache
28+
```
29+
30+
For clearing cache
31+
```
32+
php artisan eloquent:clear
33+
```
34+
35+
## Problem
36+
Simply the problem begins from [this issuge](https://github.com/laravel/framework/issues/9276).
37+
38+
39+
Currently the eloquent model class contains a cache strategy for getters which first fetches all class methods and runs a loop on them filtering them by a regular expression.
40+
This occurs [only once](https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Eloquent/Model.php#L3207) per unique eloquent final object.
41+
The getter cache container is only filled up with the [processed snake case attribute key](https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Eloquent/Model.php#L3238).
42+
43+
Each time a new model class is created for first time a loop with 50 to 100 iterations with processing a regular expression is run.
44+
45+
Wouldn't it be cool to have something like ```php artisan eloquent:cache``` for this ?
46+
47+
If you use *OPCACHE* in your PHP installation, this class will not use I/O for each script run, as opcache loads code into memory.
48+
49+

0 commit comments

Comments
 (0)