Skip to content

Commit e92675d

Browse files
committed
Docs dont live here anymroe
1 parent 8921125 commit e92675d

1 file changed

Lines changed: 2 additions & 68 deletions

File tree

README.md

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -17,72 +17,6 @@ You can also optionally publish the config:
1717
php artisan vendor:publish --tag=statamic-cache-tracker-config
1818
```
1919

20-
## How it works
20+
## Documentation
2121

22-
The addon should work auto-magically in most cases. It listens for hooks in form, nav and partial tags, as well as augmentation of entries, terms, assets and globals to determine what content is being output.
23-
24-
This data is then added to a cache store that is used to determine what cached data should be invalidated when tracked items are saved or deleted. If you want to clear data on other events (eg clear any page builder elements on entry create), just add a listener and call invalidate on the Tracker facade (eg. `Tracker::invalidate(['partial:_partials/my_pagebuilder_block']`);
25-
26-
27-
The default cache is used, or if you have specified a `static_cache` store this will be used instead. This data will then be cleared when your static cache is cleared.
28-
29-
30-
### Middleware
31-
The autocache middleware will automatically be added to your `web` middleware stack. If you want to include it to other stacks simply add:
32-
33-
`\Thoughtco\StatamicCacheTracker\Http\Middleware\CacheTracker::class`
34-
35-
### Tracker Facade
36-
The addon comes with a Facade for interacting with the Tracker:
37-
`\Thoughtco\StatamicCacheTracker\Facades\Tracker`
38-
39-
40-
### Adding your own tracking data
41-
If you have your own custom tracking data, for example for one of your own tags, you can register them on the Facade. Please bear in mind tracking only happens while the response is generated, so where possible use augmentation hooks.
42-
43-
#### Using a closure
44-
45-
```php
46-
Tracker::addAdditionalTracker(function ($tracker, $next) {
47-
// run your logic, for example in an augmentation hook
48-
// then call:
49-
$tracker->addContentTag('your-tag-here');
50-
51-
return $next($tracker);
52-
});
53-
```
54-
55-
#### Using an invokable class
56-
57-
```php
58-
class AdditionalTrackerClass {
59-
public function __invoke($tracker, $next) {
60-
$tracker->addContentTag('additional::tag');
61-
}
62-
}
63-
64-
Tracker::addAdditionalTracker(AdditionalTrackerClass::class);
65-
```
66-
67-
#### Dispatching an event
68-
69-
```php
70-
Thoughtco\StatamicCacheTracker\Events\TrackContentTags::dispatch(['additional::tag']);
71-
```
72-
73-
### Invalidating tracked data
74-
To invalidate pages containing your tracked data, use a listener or observer, and call:
75-
76-
```php
77-
$tags = ['one', 'two', 'three'];
78-
Tracker::invalidate($tags);
79-
```
80-
81-
### Flushing tracked data
82-
To invalidate all pages containing your tracked data call:
83-
84-
```php
85-
Tracker::flush();
86-
```
87-
88-
Alternatively you can use the Cache Tracker Utility in the CP to enter a list of URLs you want to clear.
22+
Documentation for this addon is available at [https://www.docs.tc/cache-tracker](https://www.docs.tc/cache-tracker).

0 commit comments

Comments
 (0)