Skip to content

Commit 8825a5a

Browse files
committed
Can cache
1 parent a7886e2 commit 8825a5a

File tree

4 files changed

+825
-44
lines changed

4 files changed

+825
-44
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ The method automatically appends __DIR__ to it, so the font will be: ````__DIR__
6565
$image = $avatar->font('/fonts/OpenSans-Semibold.ttf')->generate();
6666
````
6767

68+
### Cache - default: 0 = no cache
69+
Will use **intervention/imagecache** to cache the result.
70+
````php
71+
$image = $avatar->cache()->generate(); // 60 minutes
72+
````
73+
You can simply use ->cache() and it will set cache to 60 minutes, but you can also say ->cache(180) to cache for 180 minutes.
74+
6875
## Chaining it all together
6976
We will not use the ->font() method in this example; as I like the regular one.
7077

@@ -73,6 +80,7 @@ return $avatar->name('Lasse Rafn')
7380
->size(96) // 48 * 2
7481
->background('#8BC34A')
7582
->color('#fff')
83+
->cache()
7684
->generate()
7785
->stream('png', 100);
7886
````

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"require": {
1414
"php": "^7.0|^7.1",
1515
"intervention/image": "^2.3",
16+
"intervention/imagecache": "^2.3",
1617
"phpunit/phpunit": "^5.7"
1718
},
1819
"autoload": {

0 commit comments

Comments
 (0)