Add dispatch data caching in App\Router

- Add new cache key "routerDispatchData"
- Update Dice dependencies since Router constructor signature changed
This commit is contained in:
Hypolite Petovan 2020-07-27 01:57:44 -04:00
parent bd1f4ebbde
commit 1d0cd7328b
3 changed files with 85 additions and 12 deletions

View file

@ -247,6 +247,8 @@ class Hook
/**
* Deletes one or more hook records
*
* We have to clear the cached routerDispatchData because addons can provide routes
*
* @param array $condition
* @param array $options
* @return bool
@ -256,12 +258,18 @@ class Hook
{
$result = DBA::delete('hook', $condition, $options);
if ($result) {
DI::cache()->delete('routerDispatchData');
}
return $result;
}
/**
* Inserts a hook record
*
* We have to clear the cached routerDispatchData because addons can provide routes
*
* @param array $condition
* @return bool
* @throws \Exception
@ -270,6 +278,10 @@ class Hook
{
$result = DBA::insert('hook', $condition);
if ($result) {
DI::cache()->delete('routerDispatchData');
}
return $result;
}
}