@@ -37,10 +37,10 @@ To cache any HTML chunk, you just need to pass the caching key to the `@cache` d
37
37
38
38
``` html
39
39
@cache('simple-cache')
40
- <div >
41
- This is an arbitrary piece of HTML that will be cached
42
- using the «simple-cache» key
43
- </div >
40
+ <div >
41
+ This is an arbitrary piece of HTML that will be cached
42
+ using the «simple-cache» key
43
+ </div >
44
44
@endCache
45
45
```
46
46
@@ -75,7 +75,7 @@ To cache the model for a certain time, specify the lifetime in minutes as the se
75
75
76
76
``` html
77
77
@cache($user, 1440)
78
- <div >...</div >
78
+ <div >...</div >
79
79
@endCache
80
80
```
81
81
@@ -111,7 +111,7 @@ Usage example:
111
111
<h2 >User's cars {{ $user->name }}</h2 >
112
112
<ul >
113
113
@foreach($user->cars as $car)
114
- @include('user-car');
114
+ @include('user-car');
115
115
@endforeach
116
116
</ul >
117
117
</section >
@@ -122,7 +122,7 @@ Usage example:
122
122
123
123
``` html
124
124
@cache($car)
125
- <li >{{ $car->brand }}</li >
125
+ <li >{{ $car->brand }}</li >
126
126
@endCache
127
127
```
128
128
@@ -132,9 +132,9 @@ Example of caching a collection:
132
132
133
133
``` html
134
134
@cache($users)
135
- @foreach ($users as $user)
136
- @include('user');
137
- @endforeach
135
+ @foreach ($users as $user)
136
+ @include('user');
137
+ @endforeach
138
138
@endCache
139
139
```
140
140
@@ -146,6 +146,41 @@ Just run this code at bottom of your page:
146
146
app(SlyDeath\NestedCaching\CacheStack::class)->clearCache();
147
147
```
148
148
149
+ ## Workflow with another caches
150
+
151
+ ### How to collect keys?
152
+
153
+ Keys are automatically collected in ` SlyDeath\NestedCaching\CacheWrittenListener ` if ` another-caching ` is enabled,
154
+ but you must save them manually (at the end of executing app) if you want to use them elsewhere:
155
+
156
+ ``` php
157
+ app(\SlyDeath\NestedCaching\CacheStack::class)->getAnotherCaches();
158
+ ```
159
+
160
+ ### How to clear the stack of another caches?
161
+
162
+ Just call` clearAnotherCaches ` method:
163
+
164
+ ``` php
165
+ app(\SlyDeath\NestedCaching\CacheStack::class)->clearAnotherCaches();
166
+ ```
167
+
168
+ ### How to save keys for different pages?
169
+
170
+ You can generate dynamically the cache key (for example from the page id):
171
+
172
+ ``` php
173
+ app(\SlyDeath\NestedCaching\CacheStack::class)->setAnotherKey('my-cache-key-prefix:' . optional($page)->id)->getAnotherCaches();
174
+ ```
175
+
176
+ ### How to clear the stack of another caches with custom cache key?
177
+
178
+ Just call` clearAnotherCaches ` method and provide the key:
179
+
180
+ ``` php
181
+ app(\SlyDeath\NestedCaching\CacheStack::class)->setAnotherKey('my-cache-key-prefix:' . optional($page)->id)->clearAnotherCaches();
182
+ ```
183
+
149
184
## Enable PhpStorm support
150
185
151
186
Go to the ` Settings → PHP → Blade ` , then uncheck ** Use default settings** . Go to ** Directives** tab and press «+» to add
0 commit comments