@@ -37,10 +37,10 @@ To cache any HTML chunk, you just need to pass the caching key to the `@cache` d
3737
3838``` html
3939@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 >
4444@endCache
4545```
4646
@@ -75,7 +75,7 @@ To cache the model for a certain time, specify the lifetime in minutes as the se
7575
7676``` html
7777@cache($user, 1440)
78- <div >...</div >
78+ <div >...</div >
7979@endCache
8080 ```
8181
@@ -111,7 +111,7 @@ Usage example:
111111 <h2 >User's cars {{ $user->name }}</h2 >
112112 <ul >
113113 @foreach($user->cars as $car)
114- @include('user-car');
114+ @include('user-car');
115115 @endforeach
116116 </ul >
117117</section >
@@ -122,7 +122,7 @@ Usage example:
122122
123123``` html
124124@cache($car)
125- <li >{{ $car->brand }}</li >
125+ <li >{{ $car->brand }}</li >
126126@endCache
127127```
128128
@@ -132,9 +132,9 @@ Example of caching a collection:
132132
133133``` html
134134@cache($users)
135- @foreach ($users as $user)
136- @include('user');
137- @endforeach
135+ @foreach ($users as $user)
136+ @include('user');
137+ @endforeach
138138@endCache
139139```
140140
@@ -146,6 +146,41 @@ Just run this code at bottom of your page:
146146app(SlyDeath\NestedCaching\CacheStack::class)->clearCache();
147147```
148148
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+
149184## Enable PhpStorm support
150185
151186Go to the ` Settings → PHP → Blade ` , then uncheck ** Use default settings** . Go to ** Directives** tab and press «+» to add
0 commit comments